1

I ran into this ERROR when running "pip3 install psycopg2" on Mac.

I would like to install psycopg2 for the first time.

...
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... error
ERROR: Command errored out with exit status 1:
...

I tried pip, installing from GitHub. However, both failed.

Can someone help me, please? I really appreciate!

Yifan Ai
  • 116
  • 1
  • 2
  • 10
  • This could already been answered. See the following topic: https://stackoverflow.com/questions/34304833/failed-building-wheel-for-psycopg2-macosx-using-virtualenv-and-pip – JimShapedCoding Oct 15 '19 at 19:33
  • I tried all the proposed solutions! But did not work. I am still getting the same output. – Yifan Ai Oct 15 '19 at 19:43
  • Possible duplicate of ["Failed building wheel for psycopg2" - MacOSX using virtualenv and pip](https://stackoverflow.com/questions/34304833/failed-building-wheel-for-psycopg2-macosx-using-virtualenv-and-pip) – dmigo Oct 15 '19 at 19:46
  • Possible duplicate of [Can't install psycopg2 package through pip install... Is this because of Sierra?](https://stackoverflow.com/questions/39767810/cant-install-psycopg2-package-through-pip-install-is-this-because-of-sierra) – phd Oct 15 '19 at 19:59
  • https://stackoverflow.com/search?q=%5Bpip%5D+%5Bpsycopg2%5D+ld%3A+library+not+found+for+%22-lssl%22 – phd Oct 15 '19 at 19:59
  • I got things working finally from browsing the above links by: brew upgrade postgresql + sudo pip install psycopg2 Thank you all for commenting! – Yifan Ai Oct 15 '19 at 20:24

3 Answers3

4

Just upgrade psycopg2 version to 2.7.6 and it will work fine with python3:

pip3 install psycopg2==2.7.6
1

I have finally got things working from browsing the above links shared by these awesome people who commented on my post.

brew upgrade postgresql
sudo pip install psycopg2

Thank you all for helping!

Yifan Ai
  • 116
  • 1
  • 2
  • 10
0

Installing: Open terminal (editor or local)

$ brew install postgresql
$ brew services start postgresql

And go to sql promp for create a db (don't leave terminal):

$ psql postgres

CREATE DATABASE .. CREATE USER GRANT ...

Ayse
  • 576
  • 4
  • 13