Reputation: 11
I am getting an error when I try to install pyodbc
on a Windows
computer using cmd
.
C:\Users\Pcyber\AppData\Local\Programs\Python\Python310>python.exe -m pip install pyodbc
Collecting pyodbc
Using cached pyodbc-4.0.32.tar.gz (280 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyodbc, since package 'wheel' is not installed.
Installing collected packages: pyodbc
Running setup.py install for pyodbc ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Pcyber\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Pcyber\\AppData\\Local\\Temp\\pip-install-w2t0bax7\\pyodbc_0972efc851a7442b9e86edce259cfc8a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Pcyber\\AppData\\Local\\Temp\\pip-install-w2t0bax7\\pyodbc_0972efc851a7442b9e86edce259cfc8a\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Pcyber\AppData\Local\Temp\pip-record-xbgtptdk\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Pcyber\AppData\Local\Programs\Python\Python310\Include\pyodbc'
cwd: C:\Users\Pcyber\AppData\Local\Temp\pip-install-w2t0bax7\pyodbc_0972efc851a7442b9e86edce259cfc8a\
Complete output (5 lines):
running install
running build
running build_ext
building 'pyodbc' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Pcyber\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Pcyber\\AppData\\Local\\Temp\\pip-install-w2t0bax7\\pyodbc_0972efc851a7442b9e86edce259cfc8a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Pcyber\\AppData\\Local\\Temp\\pip-install-w2t0bax7\\pyodbc_0972efc851a7442b9e86edce259cfc8a\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Pcyber\AppData\Local\Temp\pip-record-xbgtptdk\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Pcyber\AppData\Local\Programs\Python\Python310\Include\pyodbc' Check the logs for full command output.
Upvotes: 0
Views: 315
Reputation: 11
I have uninstalled the python upgrade from python3.10 to python3.9.5 and now I can enjoy using pip without any challenges.
Upvotes: 0
Reputation: 563
pip
is trying to compile pyodbc
from source but you do not have any compiler installed on your computer. There usually are binary packages which do not need to be compiled but there is none for your python version (3.10).
You should either downgrade to an older version of python such as 3.9 or follow the instructions given by the error which is to install the Microsoft Visual C++ compiler.
Upvotes: 1
Reputation: 1168
According to that part of the error message:
extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
It looks like you are missing a suitable C++ compiler on your platform. According to the documentation of pyodbc you require one:
Note, pyodbc contains C++ extensions so you will need a suitable C++ compiler on your computer to install pyodbc, for all operating systems.
See here: https://pypi.org/project/pyodbc/
I suggest using the one form Microsoft Build Tools as suggested in your error message.
Upvotes: 0