Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting error when installing psycopg2==2.8.1

Very much brand new to this and trying to learn from a tut, I'm trying to install dependencies for a Flask build and getting an error on terminal

I have the following to install

pipenv install flask flask-sqlalchemy psycopg2 flask-migrate flask-script marshmallow flask-bcrypt pyjwt

I have check Python, PostSQL, pipenv are installed and get the following error

An error occurred while installing psycopg2==2.8.1 --hash=sha256:3648afc2b4828a6e00d516d2d09a260edd2c1e3de1e0d41d99c5ab004a73d180 --hash=sha256:5329b4530e31f58e0eafc55e26bbef684509bcc3be41604e45c0b98c297dc722 --hash=sha256:7c1ae1669d11105a002f804bebd7432f8dc7473459aa405164c6b44a922decd5 --hash=sha256:8af13498e32a00d0a66e43b7491c15231b27ab964ee4d2277a4a2dbadfb2c482 --hash=sha256:9d5489867bd5f6d6c6191a4debd8de9a5c03a9608cce3f4d7133e29e6bd4ec27 --hash=sha256:a17bfc9faffcca0ad9360c1ad97ab61ede583aa954715e8e436ffd80046661ff --hash=sha256:b4a475ce87eabc0607e068a3c704d0aa0820237ed78d493b8e2d880eb73cd7fe --hash=sha256:c49d66e97affdc80d084b3b363f09f17db621418f0b8e0524b06c54959e2094d --hash=sha256:d13fbc3d533656cfdf094e13c1b0f40917b72813755ba780971ba0ce04280ac4 --hash=sha256:e1e4fe6e8ab9f9c7d28514d007f623999d2dd6b5b81069dd4f9d30dbdd6f7069 --hash=sha256:e67d60cb1a32f5fd8fcea935cf9efb1d1c26f96203b0ca2ae98c4c40ef8d8eac! Will try again.
like image 909
GrahamMorbyDev Avatar asked Apr 08 '19 21:04

GrahamMorbyDev


4 Answers

Install psycopg2-binary instead of psycopg2.

like image 148
piro Avatar answered Oct 21 '22 09:10

piro


You need to install previously the following compiler:

sudo apt-get install libpq-dev
like image 12
Alvaro Avatar answered Oct 21 '22 08:10

Alvaro


Just exporting some flags worked for me:

export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"

from the official thread: https://github.com/psycopg/psycopg2/issues/997

like image 5
vignz.pie Avatar answered Oct 21 '22 09:10

vignz.pie


If you see Error like the following, then you should install libpq-dev

 sudo apt-get install libpq-dev 

Error: b'You need to install postgresql-server-dev-NN for building a server-side extension or libpq-dev for building a client-side application.\n'", ' ----------------------------------------', 'ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.']

like image 1
shahid Avatar answered Oct 21 '22 07:10

shahid