Solved: Installing Python's DB2 module (ibm_db) on Linux
Problem 1: I kept getting a message about not having include files installed. First, I had to get a sysadmin to install the files. But, he didn't finish the job, quite. I had to soft link it myself. That is, the include files are installed by default in /opt/ibm/db2/V10.1, but linked to from /opt/db2inst/sqllib. So:
$ sudo ln -s /opt/ibm/db2/V10.1/include /opt/db2inst/sqllib/includeThat solved the include problem.
Problem 2: I was installing IBM's DB2 python driver on a RHEL 6.2 linux box, but I kept getting the message:
Detected 64-bit PythonThis was despite executing the userprofile script in /opt/db2inst/sqllib/userprofile, which set the environment vars properly:
Environment variable IBM_DB_HOME is not set. Set it to your DB2/IBM_Data_Server_Driver installation directory and retry ibm_db module install.
xxxxx@xxxxxx:~/making/ibm_db-220.127.116.11$ env | egrep -i ibmDammit! I couldn't get past this. I tried both
- sudo easy_install ibm_db
- sudo pip install ibm_db
Finally, I downloaded the source and did the python setup.py build, which worked, so I was halfway there. Then, I had to do the sudo setup.py install (since it was to be installed in system directories): Failure (with above message about missing IBM_DB_HOME environment variable). But, I could do the env and see the vars there! So, since I'm doing this from source, I edited setup.py and put a pprint in, showing the os.envoron. This made it obvious. It showed I was executing as sudo, so as root, and root didn't have the userprofile being executed, so not var was being set.
Quick: "man sudo" !!
SOLUTION: It shows that to do this right, you must invoke sudo with -E to keep the environment variables from the current environment.
$ sudo -E python setup.py installHurray! Installed!