Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command "python setup.py egg_info" failed with error code 1 in PATH/psycopg2

I needed to upgrade PostgreSQL from version 9.5 to version 11. After that, when I recreated my virtualEnv from a 'requirements.txt' file, I started giving the following error when installing the psycopg2 package:

Collecting psycopg2 == 2.6.2 (from -r conf/requirements.txt (line 50))
  Using cached https://files.pythonhosted.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: could not determine PostgreSQL version from '11 .1 '
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0Q7bhV/psycopg2/
like image 780
Pereira Avatar asked Feb 14 '19 14:02

Pereira


2 Answers

After some research, I ran the following commands to try to solve, but it did not work:

sudo apt-get install postgresql-server-dev-all
sudo apt-get install postgresql-common

Finally, I noticed that version 2.6.2 of psycopg2 only supports version 9.5 of postgresql. For 11 you should use the latest version of psycopg2, that is, version 2.7.7. After you change the requirements.txt file, and the virtualEnv has been recreated correctly.

I hope it will be useful to others.

like image 119
Pereira Avatar answered Nov 02 '22 23:11

Pereira


Go for this Command Python3 - sudo apt install libpq-dev python3-dev

like image 24
Cipher Avatar answered Nov 03 '22 01:11

Cipher