Skip to main content

Python 3.13 is available for IBM i

·1573 words·8 mins

In November 2024, without any fanfare, Python version 3.13 became available for IBM i. This has not been celebrated at all, which is a shame because Python deserves much more attention in the IBM i community, in my opinion. IBM i was lacking behind in the Python space, with no new versions available for some years, but suddenly IBM released the new Python version 3.13 and we’re now on par with the other platforms.

What is Python?
#

Python is one of the most popular programming languages with a simple syntax, making it easy to learn and become productive very quickly. It has been called “the CL language for open source” because of its simplicity and versatility - it can be used in projects from simple script programming to data science projects and web applications. Python is number #1 in the March 2025 TIOBE index, proving its popularity and importance in the IT industry.

Python on IBM i
#

Python for IBM i runs in the PASE environment like the other open source offerings, it is not located or run in the native IBM i environment. When you have used open source offerings for a while, you will often find yourself in the PASE environment (most probably in a SSH terminal) and will be familiar with how the PASE environment works. Also, integration packages make it easy to call Python from the native environment and vice versa. Invoking Python programs can be as simple as running the STRQSH CL command, or you can use more advanced, free tools like Scott Klement’s great Unix Cmd Tool and read the output from the Python program when completed or even while it is running.

Python has been available for IBM i since the first open source packages was offered with the now deprecated 5733-OPS (Open Source for IBM i) product, way back in 2014. Ten years later we now have three versions of Python available for IBM i:

Version First release End of support Comment
Python 3.6 2016-12-23 2021-12-23 Do not use this version, it is not supported anymore!
Python 3.9 2020-10-05 2025-10-?? Nearly out of support!
Python 3.13 2024-10-07 2029-10-?? The current version, supported for five years

In addition there’s Python 2.7, but Python 2 has been deprecated for years and you should not use this for your applications! Even though it’s deprecated, Python 2 is still installed on your system because it is used by the yum package manager.

Do not uninstall Python 2 from your system - you will break yum if you do!

Maybe one day IBM will update yum to run on a newer version of Python and we can finally ditch this old piece of software.

How to install Python 3.13 on IBM i
#

There are two methods for installing open source packages:

  1. using the Open Source Package Management feature in the ACS (Access Client Solutions) GUI, or
  2. using the yum installation manager in PASE

As a system administrator I prefer a command line interface (CLI), and I always use the yum command. But both methods are documented in the IBM i Open Source documentation (a great resource for all the open source software available for IBM i).

To see the available Python 3.13 packages for IBM i with yum, you enter the SSH terminal and type

yum list "python3.13*"

(Please note the double quotes - they are necessary because we use the asterisk, which would be interpreted by the text shell if not quoted.)

The yum list command will show the available (or already installed) Python 3.13 packages:

python3.13.ppc64                            3.13.2-1               ibmi-base
python3.13-Pillow.ppc64                     11.0.0-1               ibmi-base
python3.13-bcrypt.ppc64                     3.2.2-1                ibmi-base
python3.13-cffi.ppc64                       1.17.1-1               ibmi-base
python3.13-cryptography.ppc64               3.4.7-1                ibmi-base
python3.13-devel.ppc64                      3.13.2-1               ibmi-base
python3.13-itoolkit.ppc64                   1.7.2-1                ibmi-base
python3.13-paramiko.noarch                  3.5.0-1                ibmi-base
python3.13-pip.noarch                       24.2-1                 ibmi-base
python3.13-pycparser.ppc64                  2.22-1                 ibmi-base
python3.13-pynacl.ppc64                     1.5.0-1                ibmi-base
python3.13-pyodbc.ppc64                     5.2.0-1                ibmi-base
python3.13-pytz.noarch                      2024.2-1               ibmi-base
python3.13-setuptools.noarch                75.2.0-1               ibmi-base
python3.13-six.noarch                       1.16.0-1               ibmi-base
python3.13-tkinter.ppc64                    3.13.2-1               ibmi-base
python3.13-wheel.noarch                     0.44.0-1               ibmi-base

The first line above shows the main Python 3.13 package - the basis. This is the package you need to install to have Python 3.13 on your system:

yum install python3.13

The other packages are additional packages for Python 3.13, and the packages named .ppc64 are binary packages compiled for IBM i (PowerPC 64-bit) while the ones named .noarch are packages in Python code (no architecture dependency) and available here for convenience, allowing the module to be called at the command line. Python is an interpreted language, but the interpreter itself is a compiled program for the Power processor running IBM i and PASE programs. Having a compiled version of these additional packages for Python accelerates the package at runtime, providing much better performance.

Python packages are most often installed by the Python pip package manager, which downloads the requested package from the Python Package Index (PyPI) public repository and installs the package on IBM i. Whenever you can choose between a ppc64 package compiled for IBM i and the same package in PyPI, always install the IBM i package!

You install a Python package by running the pip module:

python3.13 -m pip install <package>

To install the Python pip package manager as a command, run the following yum command:

yum install python3.13-pip

Now you can install Python 3.13 packages directly from the command line:

pip3.13 install <package>

How to install multiple Python versions
#

It is possible to have more than one version of Python installed on IBM i. This is made possible by the packages having the Python version number in their name. You specify the Python version to be used by typing the versioned python command, e.g. python3.13 for Python 3.13 and python3.9 for Python 3.9. If you type python without a version number, IBM i will run the version configured as the default.

The default Python version can be configured by the update-alternatives command:

→ update-alternatives --config python
There are 4 choices for the alternative python (providing /QOpenSys/pkgs/bin/python).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /QOpenSys/pkgs/bin/python3.13   313       auto mode
  1            /QOpenSys/pkgs/bin/python2.7    207       manual mode
  2            /QOpenSys/pkgs/bin/python3.13   313       manual mode
  3            /QOpenSys/pkgs/bin/python3.6    306       manual mode
  4            /QOpenSys/pkgs/bin/python3.9    309       manual mode

Press <enter> to keep the current choice[*], or type selection number:
Be aware that Auto mode will change the python version default whenever you install a newer Python version!

I will advice you select the preferred version in manual mode. By doing this you will keep the selected version as default and can install any other Python version next to your preferred one. Then you can test and verify the newly installed Python version does work as expected without any problems for your existing Python programs, and when you’re happy with and confident in the new version, you switch the default to the newly installed version with the update-alternatives command.

Use cases for Python
#

What can you do with Python? Well, Python can be used for everything, like most other programming languages, and here is just a few of the areas, where it could be beneficial to use Python:

  1. File management

    Python has excellent libraries for file handling, and you can easily build Python scripts to read, write, create, move, rename - whatever you can think of - files and directories in the Integrated File systems, where the native IBM i commands does not suffice. Python has libraries to help with command line tools and provide parameter validation and help text and even a TUI (text based user interface), e.g. Textual.

  2. Data export and import

    There are Python functions to read and write any popular file format, including PDF files, Excel spreadsheets and Word documents. One of my first uses of Python was a script to read the objects in a library (output from OBJECT_STATISTICS SQL table function) and populate an Excel file with the object name and type, size and last used date, adding headers, totals, filters and formulas, to show the library owner how the storage is used and the aging of the objects in the library. A detailed description of this project can be found in Creating Excel spreadsheet with IBM i library report using Python, a post published some years ago on my old blog ibmirules.blogspot.dk.

  3. Web applications and API

    Python libraries like Django and Flask makes it very easy to create web applications, and the FastAPI library provides an easy way to create REST API’s to open up the database to external applications.

  4. Data science

    The Pandas and NumPy Python libraries are extremely popular and can do all sorts of data transformation and data analysis. They can be overwhelming in the beginning because they have so many functions, but a simple example could be to read and filter a CSV file and write it to a new CSV file. I once made such a script in four(!) lines of Python code, a description of how this was done can be seen in the post called Filtering data in CSV file using Python.

More to come for Python 3.13
#

Some noticable packages are not in the package list for Python 3.13: Pandas and NumPy. And the documentation for Python is not updated to include Python 3.13. This leads me to believe that we will see more packages built and optimized for IBM i in the near future. Hopefully they will be available soon - maybe as part of a new IBM i release (which could come this year, if the release schedule pattern is followed), where a fanfare may sound for Python 3.13 as well. We will follow this closely.

Reply by Email
Christian Jorgensen
Author
Christian Jorgensen