I’m trying to install ibm-db into a virtual environment with Python running on an IBM i. I’m running into the following exception about limits.h no such file or directory. All the other similar questions I’ve found were either on Linux or MacOS, so not sure how to resolve this on an IBM i.
I also tried doing this at the system level without a virtual environment and ran into the same problem. I’m trying to install ibm-db version 3.0.2 (latest at time of this question) and that could be part of the problem. If I list the system installed packages, there is a version 2.0.5.12 of ibm-db already installed.
My IBM i is at release V7R2.
Update 2021-01-15 @ 1:42PM
This seems to not be limited to the latest version of ibm-db. I tried installing a few other versions, right down to 2.0.5 and I get the same error. So it sounds like something is missing in the environment.
Advertisement
Answer
Despite a few mentions of IBM i (or i5) in the main ibm-db project, it really doesn’t have proper support for being run from IBM i. (It may be the case that connecting to IBM i from some other platform still works; I have not verified this.) If you want to use ibm-db with IBM’s Python for PASE, you need to be using Kevin Adler’s fork. See the issue establishing this.
The most straightforward way to do this is via the RPMs (installed via yum directly, or the Access Client Solutions GUI). It looks like you already have the latest version of this installed (2.0.5.12 as of this writing).
Further, if you want to use virtual environments (which is a good idea), your best bet is to use the --system-site-packages
option, so that it finds the RPM-installed one.
Finally, if you are not tied to ibm-db, the recommended way to connect in a PEP-249-ish way is through ODBC. There is now sufficient support for ODBC on PASE that you can actually develop and test code connecting from your PC to IBM i using pyodbc, and then just use that exact same code on PASE.