pip install pyodbc fails on Windows
this fails consistently on 2 different machines one Windows Server 2012R2 and one Win8.1 the error is the same.
C:\Windows\System32>pip install pyodbc Collecting pyodbc Using cached pyodbc-3.0.10.tar.gz Installing collected packages: pyodbc Running setup.py install for pyodbc Complete output from command "c:\program files (x86)\python 3.5\python.exe" -c "import setuptools, tokenize;file='C:\Users\Kiril\AppData\Local\Temp \pip-build-wx_guj66\pyodbc\setup.py';exec(compile(getattr(tokenize, 'open', o pen)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --recor d C:\Users\Kiril\AppData\Local\Temp\pip-0hu94gdr-record\install-record.txt --sin gle-version-externally-managed --compile: running install running build running build_ext building 'pyodbc' extension error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command ""c:\program files (x86)\python 3.5\python.exe" -c "import setuptools, t
okenize;file='C:\Users\Kiril\AppData\Local\Temp\pip-build-wx_guj66\py
odbc\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().re
place('\r\n', '\n'), file, 'exec'))" install --record C:\Users\Kiril\AppData
\Local\Temp\pip-0hu94gdr-record\install-record.txt --single-version-externally-m
anaged --compile" failed with error code 1 in C:\Users\Kiril\AppData\Local\Temp
pip-build-wx_guj66\pyodbc
C:\Windows\System32>
I am having the same issue.
reading manifest file 'pyodbc.egg-info\SOURCES.txt'
Traceback (most recent call last):
File "
----------------------------------------
Command ""c:\python 3.5\python.exe" -c "import setuptools, tokenize;file='C:\Users\SDESHP~2\AppData\Local\Temp\pip-build-3mtp8ff8\pyodbc\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\SDESHP~2\AppData\Local\Temp\pip-cvlyp954-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\SDESHP~2\AppData\Local\Temp\pip-build-3mtp8ff8\pyodbc
It looks like you're both using Python 3.5. Does this also happen with older Python versions?
I experienced the issue only with Python 3.5
I am on Windows Python 3.5, and I get the same issue
File "c:\users\dvarghes\appdata\local\programs\python\python35\lib\site-packages\setuptools\command\egg_info.py", line 232, in append
path = convert_path(item)
File "c:\users\dvarghes\appdata\local\programs\python\python35\lib\distutils\util.py", line 125, in convert_path
raise ValueError("path '%s' cannot be absolute" % pathname)
ValueError: path '/Users/mkleehammer/dev/pyodbc/src/buffer.cpp' cannot be absolute
----------------------------------------
Command "c:\users\dvarghes\appdata\local\programs\python\python35\python.exe -c "import setuptools, tokenize;file='C:\Users\dvarghes\AppData\Local\Temp\pip-build-uk7rkkwm\pyodbc\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\dvarghes\AppData\Local\Temp\pip-bzombnw1-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\dvarghes\AppData\Local\Temp\pip-build-uk7rkkwm\pyodbc
Same problem here. C:\Users\user\AppData\Local\Programs\Python\Python35>cd Scripts
C:\Users\user\AppData\Local\Programs\Python\Python35\Scripts>pip install pyodbc Collecting pyodbc Using cached pyodbc-3.0.10.tar.gz Installing collected packages: pyodbc Running setup.py install for pyodbc Complete output from command c:\users\user\appdata\local\programs\python\pyt hon35\python.exe -c "import setuptools, tokenize;file='C:\Users\user\AppD ata\Local\Temp\pip-build-sg8od2fp\pyodbc\setup.py';exec(compile(getattr(tok enize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Users\user\AppData\Local\Temp\pip-07nqf11x-record\install-r ecord.txt --single-version-externally-managed --compile: running install running build running build_ext building 'pyodbc' extension error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "c:\users\user\appdata\local\programs\python\python35\python.exe -c "imp ort setuptools, tokenize;file='C:\Users\user\AppData\Local\Temp\pip-bu ild-sg8od2fp\pyodbc\setup.py';exec(compile(getattr(tokenize, 'open', open)(f ile).read().replace('\r\n', '\n'), file, 'exec'))" install --record C:\Use rs\user\AppData\Local\Temp\pip-07nqf11x-record\install-record.txt --single-versi on-externally-managed --compile" failed with error code 1 in C:\Users\user\AppDa ta\Local\Temp\pip-build-sg8od2fp\pyodbc
There is no wheel (binary distribution) for 3.5 on PyPI. So while they are not provided you can use unofficial binaries from here. Just download the matching file for Python 3.5 and install it with pip install pyodbc-3.0.10-cp35-none-win32.whl.
Thanks schlamar. That worked nicely.
Also thank you, I searched for hours for an answer on this!
Thanks this solved my problem too! "Once more into the breech" solving problems one at a time, together!
schlamar the world needs more people like you :)
Hi,
This also happen on Python 2.6
Regards.
@mkleehammer I love pyodbc. Is there any way you could put a wheel for Python 3.5 up on PyPI?
This would make it much easier to build upon!
I too would appreciate a whl for this on pypi
This is one of the first things to appear when googling the error message about buffer.cpp cannot be absolute with pyodbc.
If you download the source .tar.gz file from pypi, open pyodbc.egg-info\SOURCES.txt and remove the series of lines at the top of the file that begin with /User/mkleehammer/.... and then run python setup.py build followed by python setup.py install it should work.
I don't know why those files are listed, if you look at the end file paths they match files already listed a bit more down in the SOURCES.txt file.
@schlamar I installed pyodbc for my python 3.6. But when I am not able to use that in my code. It says, "the definition was found at C:\pyodbc.pyd.. (which can't be opened because it is a compiled extension)". Please help
@PythonNovice5 How did you install pyodbc? I am now providing binary wheels for Windows and macOS for most versions of Python.
If you did not use pip, please try again with: pip install pyodbc
(If you ever need to upgrade pyodbc but it is already installed, use: pip install --upgrade pyodbc)
@mkleehammer I installed it using "python -m pip install pyodbc" command as "pip install -U pyodbc" (-U to install upgraded version) gives 'fatal launch error' for python 3.6. The error I got for compiled extension is gone now, as I had to install few other libraries (Bx4, python-form etc) in my python framework and after that the error was gone. Though I still don't understand why it was showing error before and how come python framework is taking compiled file (pyodbc.pyd in site-packages) for usage.
Thanks for the wheels anyway, it was a great relief after searching for the solution for hours.
Note for users of tox who come here!!
This error will occur if you try to run PyODBC under tox on Windows, and its because tox is actually suppressing the WINDIR environment variable. You can just pass that variable through and this error will go away.
I did a brief write up on that here: www.kidstrythisathome.com/2017/02/tox-pyodbc-and-appveyor.html
@LegoStormtroopr Wow - I did not know that. Thanks. We should get that on the Wiki somewhere.
Just to clarify - pyodbc itself isn't looking for any environment variables. I would bet that the driver was installed with those in the odbcinst.ini.
Not quite sure if this is related, but when I ran:
python setup.py install (with python 3.5, windows 7, and visual studio 2015)
I got the following error:
pyodbc-4.0.13\src\pyodbc.h(19): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
After looking at https://github.com/openssl/openssl/issues/586 I installed windows 8.1 SDK and the install was successful.