0

I have created a virtual environment for flask development.now, I want to install pyodbc to connect with sql server. I tried to install with pip install pyodbc in my virtual environment. I got following error-

Collecting pyodbc
  Using cached https://files.pythonhosted.org/packages/75/29/aa190749bac37ede0f11a68a75e7055254699c11572bd94213f1163dfd8f/pyodbc-4.0.27.tar.gz
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error

>ERROR: Command errored out with exit status 1:
   command: 'C:\Users\bitre\Anaconda3\envs\flaskEnv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\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 'C:\Users\bitre\AppData\Local\Temp\pip-wheel-49fya41s' --python-tag cp38
       cwd: C:\Users\bitre\AppData\Local\Temp\pip-install-313n7fr3\pyodbc\
  Complete output (5 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
  ----------------------------------------
  >ERROR: Failed building wheel for pyodbc
  Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\bitre\Anaconda3\envs\flaskEnv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\bitre\AppData\Local\Temp\pip-record-645ww_jo\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\bitre\AppData\Local\Temp\pip-install-313n7fr3\pyodbc\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\bitre\Anaconda3\envs\flaskEnv\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\setup.py'"'"'; __file__='"'"'C:\\Users\\bitre\\AppData\\Local\\Temp\\pip-install-313n7fr3\\pyodbc\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\bitre\AppData\Local\Temp\pip-record-645ww_jo\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I tried outside virtual Environment, Requirement already satisfied: pyodbc in c:\users\bitre\anaconda3\lib\site-packages (4.0.26)

ameya
  • 201
  • 2
  • 16
  • Does this answer your question? [Error while installing lxml through pip: Microsoft Visual C++ 14.0 is required](https://stackoverflow.com/questions/38949519/error-while-installing-lxml-through-pip-microsoft-visual-c-14-0-is-required) – phd Dec 20 '19 at 13:23
  • https://stackoverflow.com/search?q=%5Bpip%5D+error%3A+Microsoft+Visual+C%2B%2B+14.0+is+required – phd Dec 20 '19 at 13:23
  • Please follow this posted by myself: https://stackoverflow.com/a/70679354/8614314 – Palash Mondal Jan 12 '22 at 09:47
  • I answer it in another question please follow it. https://stackoverflow.com/a/70796395/8614314 – Palash Mondal Jan 21 '22 at 04:30

1 Answers1

0

You can try installing using this command if anaconda as a base in virtual environment-:

conda install -c anaconda pyodbc
Ridhima Garg
  • 67
  • 11