Today I encountered this "ImportError: No module named CUBRIDdb" error when trying to install and use the Python driver for CUBRID 8.4.3 on CentOS 5.6 x64. To install the driver I followed Create a CUBRID Database VM with Vagrant and Chef Cookbook under 5 minutes tutorial.
After everything was successfully installed, I created a simple Python program which executes a SELECT query. When I ran the program, I have received the following error:
$ python cubrid_example.py
Traceback (most recent call last):
File "cubrid_example.py", line 1, in ?
import CUBRIDdb
ImportError: No module named CUBRIDdb
The problem happened to be due to these two facts:
For these reasons the Python cookbook installs Python 2.6 on CentOS 5.x and configures pip and virtualenv on top of Python 2.6, not Python 2.4. Thus:
So, when I ran python cubrid_example.py it used the default Python 2.4, and of course, the CUBRID driver is not available there.
There are two solution to this problem:
$python26 cubrid_example.py
Both solutions work fine.