Python for Oracle Linux

All about developing with Python on Oracle Linux

  • Home > 
  • Python for Oracle Linux

Table of Contents

About Python on Oracle Linux

There are several ways to get started with Python development on Oracle Linux. Oracle Linux yum server offers updates for Platform Python included with Oracle Linux as well as new versions of Python via the Software Collection Library (SCL) and AppStream Modules. The different Python versions available and the corresponding repository and RPM names are summarized in the tables below.


Oracle Linux 9
Python Version Repository: RPM Name Module Stream Name
3.12 ol9_appstream: python3.12
3.11 ol9_appstream: python3.11
3.9 ol9_appstream: python3

Oracle Linux 8
Python Version Repository: RPM Name Module Stream Name
3.12 ol8_appstream: python3.12
3.11 ol8_appstream: python3.11
3.9 python39
3.8 python38
3.6 python36
2.7 python27

Oracle Linux 7
Python Version Repository: RPM name
3.8 ol7_software_collections: rh-python38
3.6 ol7_software_collections: rh-python36
3.5 ol7_software_collections: rh-python35
3.4 ol7_software_collections: rh-python34
2.7 ol7_latest: python


Installing Python

Platform Python

As Python is an integral part of the Oracle Linux operating system, each release comes with a Platform Python version. For Oracle Linux 7, the Platform Python is 2.7, and is always installed. Starting Oracle Linux 7.7, Python 3 is also available. Additional versions of Python may be installed using Software Collection Library packages.

On Oracle Linux 8 Python is 3.6 and it is exclusively intended for use by system utilities such as Yum and DNF. Python for general purpose use is not installed by default on Oracle Linux 8. You may install your desired version of Python may be installed using AppStream Modules.

For Oracle Linux 9, the Platform Python is 3.9.

About Support for Python 2

The Python Software Foundation, the community organization behind Python, previously announced the Python 2 series would reach end-of-life on January 1, 2020 with release 2.7. Because Oracle Linux is an enterprise Linux distribution, support decisions for components in the operating system are made independently from those made in the upstream community. Therefore, Python 2 remains supported in Oracle Linux as outlined below.

Continued support for Python 2 in Oracle Linux 7

Python 2 remains supported in Oracle Linux 7. As such, critical security errata and select high-impact critical bug fixes will be provided while Oracle Linux 7 is covered under Oracle Linux Premier support as detailed in the Lifetime Support Policy

Full life cycle for Python 3.6 on Oracle Linux 8

Python 3.6 is supported for the full life cycle of Oracle Linux 8, during which critical security errata and select high-impact critical bug fixes will be provided.

Full life cycle for Python 3.9 on Oracle Linux 9

Python 3.9 is supported for the full life cycle of Oracle Linux 9, during which critical security errata and select high-impact critical bug fixes will be provided.

Continued support for Python 2 in Oracle Linux 8

Python 2 is delivered in Oracle Linux 8 via Application Streams and may optionally be installed. Python 2 is supported for part of the Oracle Linux 8 life cycle and critical security errata and select high-impact critical bug fixes will be provided according to this Oracle Linux 8 Application Stream Life Cycle.

Installing Python 3 from the Oracle Linux 7 Latest Repository

Oracle Linux 7.7 and newer include Python 3.

To install Python 3 from the Oracle Linux 7 latest repository:

$ sudo yum install -y python3


Note that python3-devel is in the ol7_optional_latest repository. To install python3-devel:

$ sudo yum install -y --enablerepo ol7_optional_latest python3-devel


Installing Python From the Software Collection Library

The Software Collection Library (SCL) is intended for development environments which require access to the latest features of software components such as Perl, PHP, or Python. For these environments, it's important to minimize the disruption of system processes that rely on the versions of these components. The SCL enables you to install and use several versions of the same software on a system, simultaneously, and without disruption.

To install Python 3.8 from the SCL on Oracle Linux 7, install oracle-softwarecollection-release-el7 and then install scl-utils and rh-python38:

$ sudo yum install -y oracle-softwarecollection-release-el7
$ sudo yum -y install scl-utils rh-python38


To enable and use Python 3.8 from the SCL:

$ scl enable rh-python38 bash
$ python

Installing Python on Oracle Linux 8 via AppStream Modules

Oracle Linux 8 introduces the concept of Application Streams, where multiple versions of user-space components can be delivered and updated more frequently than the core operating system packages in RPM format or groups of related RPMs called Modules. Oracle Linux 8 offers several independently updated versions of Python via seperate modules.

To list available Python modules:

$ sudo dnf module list | grep python


To install the Python 3.9 module and run Python 3.9:

$ sudo dnf module install python39
$ python3.9


To use pip with Python 3.9 for installing additional Python packages:

$ sudo dnf install python39-pip
$ python3.9 -m pip install <package name>

To create a virtual environment using venv:

$ python3.9 -m venv py39env
$ source py39env/bin/activate


Installing Python on Oracle Linux 9

Oracle Linux 9 includes the concept of Application Streams, where multiple versions of user-space components can be delivered and updated more frequently than the core operating system packages in RPM format or groups of related RPMs called Modules. The initial release of Oracle Linux 9 includes Python 3.9 as the full lifecycle Python release; further python release may be released as AppStream Modules in the future.

To install and run Python 3.9:

$ sudo dnf install python3
$ python

To create a virtual environment using venv:

$ python -m venv py39env
$ source py39env/bin/activate


Connecting Python to Oracle Database

python-oracledb is a module that enables access to Oracle Database and conforms to the Python database API specification. For more details, see the python-oracledb driver documentation

About Oracle Instant Client

Oracle Instant Client libraries are optional for python-oracledb. Some advanced Oracle Database functionalities are currently only available when those are installed, see Enabling python-oracledb Thick mode

Starting with Oracle Instant Client 21c, yum/dnf configuration files are delivered via the packages oracle-instantclient-release-el8 and oracle-instantclient-release-el7, respectively. Oracle Instant Client packages up to release 19c are in the ol7_oracle_instantclient and ol8_oracle_instantclient repositories, configured with release packages oracle-release-el7 and oracle-release-el8. Assuming you have enabled the repository for Oracle Instant Client appropriate for your Oracle Linux release, it will be installed as a dependency. See Instant Client for Oracle Linux for details about installing Oracle Instant Client.

Installing python-oracledb for Python 3

To install python-oracledb for Python 3 on Oracle Linux 7:

$ sudo yum -y install oraclelinux-developer-release-el7
$ sudo yum -y install python3-oracledb


To install python-oracledb for Python 3 on Oracle Linux 8:

$ sudo dnf -y install oraclelinux-developer-release-el8
$ sudo dnf -y install python3-oracledb


Python in Containers

To run Python applications —including the python-oracledb package— in containers see the resources below:

Support

Oracle Linux customers receive support for Platform Python and Python packages in the Software Collection Library. Community support is available in the Python and Oracle Developer Community.


References

Contact Us

software.hardware.complete
Subscribe | Careers | Contact Us | Legal Notices | Terms of Use | Your Privacy Rights