Are you an independent software vendor (ISV) or a customer looking to develop Python applications on the IBM Power platform? Then this blog is for you! It walks you through some examples of using the IBM Open Source Edge and the IBM optimized, prebuilt Python wheels for developing Python applications on IBM Power.
Getting Started with Your Application
To take full advantage of the optimized Python wheels for IBM Power, follow these steps to set up your development environment and test package installation.
✅ Recommended Python Versions
Use Python 3.10, 3.11, or 3.12 — these versions have the broadest support for prebuilt packages in the IBM wheel repository.
🛠️ Step 1: Create a Local Virtual Environment
Creating a virtual environment helps isolate dependencies and ensures a clean setup.
python3.12 -m venv venv
source venv/bin/activate
🧪 Example 1: Install a Package from the IBM Optimized Wheel Repository
Let’s install the pillow package using pip, prioritizing the prebuilt Power binaries from IBM’s DevPi server.
#!/bin/bash
# The pip --prefer-binary option prioritizes prebuilt Power binaries over building packages from source distributions,
# even if a newer source distribution is available
#
# The pip --extra-index-url option specifies the IBM optimized wheel repository as an additional package index where pip should search for packages,
# in addition to the default PyPI (Python Package Index) or any index specified with --index-url.
$ pip install --prefer-binary pillow --extra-index-url=https://wheels.developerfirst.ibm.com/ppc64le/linux
Sample Output:
((venv) ) $ pip install --prefer-binary pillow --extra-index-url=https://wheels.developerfirst.ibm.com/ppc64le/linux
Looking in indexes: https://pypi.org/simple, https://wheels.developerfirst.ibm.com/ppc64le/linux
Collecting pillow
Downloading https://wheels.developerfirst.ibm.com/ppc64le/linux/%2Bf/05f/232918bf94c8d/pillow-11.3.0%2Bppc64le1-cp312-cp312-manylinux_2_34_ppc64le.whl (2.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.8/2.8 MB 19.7 MB/s eta 0:00:00
Installing collected packages: pillow
Successfully installed pillow-11.3.0+ppc64le1
🎉 Success! You’ve installed a prebuilt, optimized wheel for IBM Power.
🧪 Example 2: Training a LightGBM Model with AI/ML Packages
This example demonstrates how to build a simple machine learning application using LightGBM, scikit-learn, PyArrow, and Pillow on IBM Power. The application trains a model on an Iris-like dataset, generates predictions, and outputs visuals and metadata. You can find the full source code for this example in the pyeco GitHub repository: 🔗lightgbm-pyarrow-example
🔍 Summary of Steps
-
Create a virtual environment using Python 3.12
-
Install required packages from the IBM optimized wheel repository
-
Resolve runtime errors related to native libraries and dependencies
-
Run the application and validate functionality
-
Generate a pinned requirements.txt for reproducibility
🛠️ Step-by-Step Installation
✅ Create a Virtual Environment
python3.12 -m venv myvenv
source myvenv/bin/activate
📦 Install AI/ML Packages
Each command uses --prefer-binary and --extra-index-url to prioritize IBM's optimized wheels.
# Install LightGBM (pulls in numpy and scipy)
pip install lightgbm==4.5.0 pyarrow==18.0.0 pillow==11.2.1 scikit-learn==1.5.2 \
--prefer-binary \
--extra-index-url=https://wheels.developerfirst.ibm.com/ppc64le/linux
🧯 Troubleshooting Runtime Errors
⚠️ Dependency Conflicts - Conflicting versions of numpy caused runtime issues.
(.venv) [root@dcfbad9f5448 /]# python lightgbm-pyarrow-example.py
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.3.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Solution: Downgrade numpy to a compatible version:
pip install numpy==1.26.4 \
--prefer-binary \
--extra-index-url=https://wheels.developerfirst.ibm.com/ppc64le/linux
✅ Finalizing the Environment
Once your application runs successfully, freeze the environment to capture exact versions:
pip freeze > requirements.txt
Sample requirements.txt:
joblib==1.5.3
lightgbm==4.5.0+ppc64le1
numpy==1.26.4+ppc64le1
pillow==11.2.1+ppc64le1
pyarrow==18.0.0+ppc64le1
scikit-learn==1.5.2+ppc64le1
scipy==1.17.0+ppc64le1
threadpoolctl==3.6.0
📌 Why Pinning Versions Matters
-
Ensures consistent installs across environments
-
Improves reproducibility in CI/CD pipelines
-
Simplifies debugging and dependency management
-
Prevents unexpected changes in transitive dependencies
🧪 Example 3: Building docling Using Pre‑requisites from the Python Wheel Repository for IBM Power