psycopg2 installation error: Unable to find vcvarsall.bat
Question: 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..


Answer: 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.](http://www.stickpeople.com/projects/python/win-psycopg/)

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.](https://stackoverflow.com/questions/28611808/how-to-intall-
psycopg2-for-python-3-5) (One of the comments says there's not a version for
Python 3.5 on the linked page, but that's not true anymore)

