Can't install psycopg2

10,029

Solution 1

Turns out this 3 and a half hour process I've been going through was unecessary. an exe installer of psycopg2 can be downloaded from here

Solution 2

In case anyone goes down this rabbit hole also, make sure your pip is up-to-date:

$ pip install -U pip
$ pip install psycopg2-binary

See: http://initd.org/psycopg/docs/install.html.

That's 3 hours of my life I won't get back.

Solution 3

Had the same problem.

Image of the error message

first run sudo apt install libpq-dev python3-dev

then pip3 install psycopg2

Share:
10,029
kag359six
Author by

kag359six

Updated on June 04, 2022

Comments

  • kag359six
    kag359six almost 2 years

    I'm trying to install psycopg2 so I can use PostgreSQL in Python and Django. I have run into multiple errors in the last few hours trying to install it, and can't seem to solve the latest one. When I run:

    setup.py install
    

    on the psycopg2 in the command console it attempts to install it, but then gives an error when trying to execute link.exe in the Visual Studio 8 folder.

    This doesn't make sense to me, considering I got that executable to work when I launch it from Windows Explorer, and from the command console. I even made an environment variable for it. However, it keeps giving:

    "error: command C:\Program Files(x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe" failed with exit status 1120