Django 'pip install django-heroku'(psycopg2) error is blocking deployment to Heroku

I have tried several solutions, none worked except simplest solution:

pip3 install psycopg2==2.7.5

this command worked perfectly (seems like a problem with a version)


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

I was searching and this finally worked for me.


To install heroku in django the command line django-heroku changed to

pip install django-on-heroku