ravi singh
ravi singh

Reputation: 3

getting error while installing psycopg2 in vscode on windows

I am trying pip install psycopg2 in vscode cmd on windows 8.1, which results in the following error.

ERROR: Command errored out with exit status 1:
   command: 'c:\users\rock\envs\demo\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\rock\\AppData\\Local\\Temp\\pip-install-fczxt3cu\\psycopg2\\setup.py'"'"'; __file__='"'"'C:\\Users\\rock\\AppData\\Local\\Temp\\pip-install-fczxt3cu\\psycopg2\\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\rock\AppData\Local\Temp\pip-wheel-i_fkxw14' --python-tag cp38
       cwd: C:\Users\rock\AppData\Local\Temp\pip-install-fczxt3cu\psycopg2\
  Complete output (22 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\psycopg2
  copying lib\compat.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\errorcodes.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\errors.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\extensions.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\extras.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\pool.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\sql.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\tz.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_ipaddress.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_json.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_lru_cache.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\_range.py -> build\lib.win-amd64-3.8\psycopg2
  copying lib\__init__.py -> build\lib.win-amd64-3.8\psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

Upvotes: 0

Views: 1411

Answers (1)

Simon Notley
Simon Notley

Reputation: 2136

The solution is in the error message. You need the Visual C++ runtime installed. Go to

https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

and download the version appropriate to your system, then install and try again.

EDIT: Correct answer

The error message is misleading in this case. It's an issue with psycopg, it doesn't appear to support Python 3.8 on Windows yet. Solution is to use 3.7 until psycopg is ready.

https://github.com/psycopg/psycopg2/issues/990

Upvotes: 1

Related Questions