0

I'm trying connect my django 1.9 project to postgresql database. First of all i need to install psycopg2. I got my psycopg file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#psycopg . However I could not install, I have an "Unable to find vcvarsall.bat" error.

My python version is 3.5.1.

Here is my error;

copying tests\test_quote.py -> build\lib.win-amd64-3.5\psycopg2\tests
copying tests\test_transaction.py -> build\lib.win-amd64-3.5\psycopg2\tests
copying tests\test_types_basic.py -> build\lib.win-amd64-3.5\psycopg2\tests
copying tests\test_types_extras.py -> build\lib.win-amd64-3.5\psycopg2\tests

copying tests\test_with.py -> build\lib.win-amd64-3.5\psycopg2\tests
copying tests\__init__.py -> build\lib.win-amd64-3.5\psycopg2\tests
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
running build_ext
building 'psycopg2._psycopg' extension
error: Unable to find vcvarsall.bat

----------------------------------------
Command "c:\python\python35\python.exe -c "import setuptools, tokenize;__file__=
'C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-4q_3mvan\\psycopg2\\setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\
n'), __file__, 'exec'))" install --record C:\Users\User\AppData\Local\Temp\pip-e
kz8kaam-record\install-record.txt --single-version-externally-managed --compile"
 failed with error code 1 in C:\Users\User\AppData\Local\Temp\pip-build-4q_3mvan
\psycopg2

Does anyone have an idea ? Thank you..

kbrk
  • 610
  • 1
  • 9
  • 27
  • 1
    The command to install psycopg2 using the downloaded wheel file is `c:\python\python35\python.exe -m pip install psycopg2-2.6.1-cp35-none-win_amd64.whl` – cgohlke Dec 10 '15 at 19:35
  • this is the answer. thank you very much.. – kbrk Dec 12 '15 at 11:22

1 Answers1

1

psycopg2 needs to be compiled various development libraries. On Windows this is usually automated by using some version of Visual Studio -- which is what the vcvarsall.bat file is all about -- and is usually a huge pain. Fortunately, Jason Erickson maintains a Windows port of psycopg2 here.

I see now that you're using Python 3.5, and there doesn't seem to be a release for that version available on that page. Fortunately, there's an answer for that already on Stack Overflow. (One of the comments says there's not a version for Python 3.5 on the linked page, but that's not true anymore)

James J.
  • 216
  • 1
  • 5
  • Thank you James. yes i know that post. It had posted in February. it seems there is still no python 3.5 support for psycopg2. – kbrk Dec 10 '15 at 08:40