getting error "ImportError: No module named 'ibm_db_dbi'" from ibm_db2_Sa package

876 views
Skip to first unread message

sidd...@erpdata.cloud

unread,
May 10, 2018, 6:38:55 AM5/10/18
to sqlalchemy
Hi,
I am using ibm_db_sa driver.My connection code is "create_engine("db2+ibm_db://dbinst1:********@192.168.XX.XXX:XXXXX/sample",pool_size=20, echo=False, poolclass=QueuePool).connect()"
When I am try to connect to db I got below error

ImportError: No module named 'ibm_db_dbi'


Message has been deleted

Anvith Shivakumara

unread,
May 10, 2018, 7:14:55 AM5/10/18
to sqlalchemy
Installing sqlalchemy does not mean all the supported drivers also get installed.

So, as a first step, please make sure you have ibm_db drivers installed.

You could do that using pip.

sidd...@erpdata.cloud

unread,
May 10, 2018, 7:27:18 AM5/10/18
to sqlalchemy
I have installed ibm_db2_sa driver. But when I am going to installed ibm_db2 driver its gives following error

Collecting ibm_db
Building wheels for collected packages: ibm-db
  Running setup.py bdist_wheel for ibm-db ... error
  Complete output from command /home/siddhesh/Envs/agentenv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yra9wier/ibm-db/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-8dx4t69k --python-tag cp35:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-yra9wier/ibm-db/setup.py", line 17, in <module>
      os.rename('tests','test_2')
  OSError: [Errno 39] Directory not empty: 'tests' -> 'test_2'
  
  ----------------------------------------
  Failed building wheel for ibm-db
  Running setup.py clean for ibm-db
  Complete output from command /home/siddhesh/Envs/agentenv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yra9wier/ibm-db/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-yra9wier/ibm-db/setup.py", line 17, in <module>
      os.rename('tests','test_2')
  OSError: [Errno 39] Directory not empty: 'tests' -> 'test_2'
  
  ----------------------------------------
  Failed cleaning build dir for ibm-db
Failed to build ibm-db
Installing collected packages: ibm-db
  Running setup.py install for ibm-db ... error
    Complete output from command /home/siddhesh/Envs/agentenv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yra9wier/ibm-db/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-hfsln98x/install-record.txt --single-version-externally-managed --compile --install-headers /home/siddhesh/Envs/agentenv/include/site/python3.5/ibm-db:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-yra9wier/ibm-db/setup.py", line 17, in <module>
        os.rename('tests','test_2')
    OSError: [Errno 39] Directory not empty: 'tests' -> 'test_2'
    
    ----------------------------------------
Command "/home/siddhesh/Envs/agentenv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-yra9wier/ibm-db/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-hfsln98x/install-record.txt --single-version-externally-managed --compile --install-headers /home/siddhesh/Envs/agentenv/include/site/python3.5/ibm-db" failed with error code 1 in /tmp/pip-install-yra9wier/ibm-db/
Reply all
Reply to author
Forward
0 new messages