WalkingDeadFan
WalkingDeadFan

Reputation: 647

Cannot pip install ibm_db on windows 7

I'm having problems installing ibm_db. I'm getting a "Cannot create a file when that file already exists: 'tests' -> 'test_2'"

I'm using windows 7 x64, Python 3.6. The aim is to use SQLAlchemy to connect to a db2 database. I have already installed the ibm-db-sa database.

Any ideas on how to solve this would be great.

(.env) C:\Users\123456789\Documents\the_funny_app>pip install ibm_db
Collecting ibm_db
  Downloading ibm_db-2.0.8.tar.gz (689kB)
    100% |████████████████████████████████| 696kB 17.1MB/s
Building wheels for collected packages: ibm-db
  Running setup.py bdist_wheel for ibm-db ... error
  Complete output from command c:\users\123456789\documents\the_funny_app\.env\scripts\py
thon.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppDa
ta\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open
', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
de, __file__, 'exec'))" bdist_wheel -d C:\Users\139206~1\AppData\Local\Temp\tmpc
gu3awilpip-wheel- --python-tag cp36:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup.p
y", line 17, in <module>
      os.rename('tests','test_2')
  FileExistsError: [WinError 183] Cannot create a file when that file already ex
ists: 'tests' -> 'test_2'

  ----------------------------------------
  Failed building wheel for ibm-db
  Running setup.py clean for ibm-db
  Complete output from command c:\users\123456789\documents\the_funny_app\.env\scripts\py
thon.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppDa
ta\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open
', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(co
de, __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup.p
y", line 17, in <module>
      os.rename('tests','test_2')
  FileExistsError: [WinError 183] Cannot create a file when that file already ex
ists: '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 c:\users\123456789\documents\the_funny_app\.env\scripts\
python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\139206~1\\App
Data\\Local\\Temp\\pip-build-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'op
en', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(
code, __file__, 'exec'))" install --record C:\Users\139206~1\AppData\Local\Temp\
pip-g1oa_y2_-record\install-record.txt --single-version-externally-managed --com
pile --install-headers c:\users\123456789\documents\the_funny_app\.env\include\site\pytho
n3.6\ibm-db:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\setup
.py", line 17, in <module>
        os.rename('tests','test_2')
    FileExistsError: [WinError 183] Cannot create a file when that file already
exists: 'tests' -> 'test_2'

    ----------------------------------------
Command "c:\users\123456789\documents\the_funny_app\.env\scripts\python.exe -u -c "import
 setuptools, tokenize;__file__='C:\\Users\\139206~1\\AppData\\Local\\Temp\\pip-b
uild-xss0on0u\\ibm-db\\setup.py';f=getattr(tokenize, 'open', open)(__file__);cod
e=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
" install --record C:\Users\139206~1\AppData\Local\Temp\pip-g1oa_y2_-record\inst
all-record.txt --single-version-externally-managed --compile --install-headers c
:\users\123456789\documents\the_funny_app\.env\include\site\python3.6\ibm-db" failed with
 error code 1 in C:\Users\139206~1\AppData\Local\Temp\pip-build-xss0on0u\ibm-db\

Upvotes: 2

Views: 3580

Answers (1)

mao
mao

Reputation: 12287

Converting comments into answer.

This is a known issue with v2.0.8 of ibm_db on Win7, since fixed, you can either install the fixed version or the previous version. Additionally any version of ibm_db higher than v2.0.8 will contain the fix.

June 20th 2020: ibm_db v3.0.2 released.

See github report

To install the fixed version:

pip install "ibm-db==2.0.8a" (any version higher than 2.0.8)

To install the previous version:

pip install "ibm-db<2.0.8"

Upvotes: 6

Related Questions