"Failed building wheel for psycopg2" - MacOSX using virtualenv and pip "Failed building wheel for psycopg2" - MacOSX using virtualenv and pip postgresql postgresql

"Failed building wheel for psycopg2" - MacOSX using virtualenv and pip


I had the same problem on Arch linux. I think that it's not an OS dependant problem. Anyway, I fixed this by finding the outdated packages and updating then.

pip uninstall psycopg2pip list --outdatedpip install --upgrade wheelpip install --upgrade setuptoolspip install psycopg2

hope this helps...


I was also getting same error. Using Python 3.7.3 and pip 19.1.1.

error screen

I used following command.

pip install psycopg2-binary==2.8.3


For MacOS users

After trying all the above methods (which did not work for me on MacOS 10.14), that one worked :

  • Install openssl with brew install openssl if you don't have it already.
  • add openssl path to LIBRARY_PATH :
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
  • install psycopg2 with pip pip3 install psycopg2