1

I am trying to install pyscopg2 on kali-linux after installing postgresql I tried :

$ sudo pip3 install pyscopg2

and I get the following :

ERROR: Complete output from command python setup.py egg_info:
    ERROR: running egg_info
    creating pip-egg-info/psycopg2.egg-info
    writing pip-egg-info/psycopg2.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
    Error: b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_hg2dt6y/psycopg2/

1) I tried :

$ sudo pip3 install postgresql-server-dev-X.Y

and I get the following :

ERROR: Could not find a version that satisfies the requirement postgresql-server-dev-X.Y (from versions: none)
ERROR: No matching distribution found for postgresql-server-dev-X.Y

I expect pyscopg2 to be installed .

Martin
  • 594
  • 1
  • 8
  • 32
jack work
  • 21
  • 4
  • 2
    X.Y is a placeholder... – jordanm Jul 15 '19 at 13:52
  • Possible duplicate of [You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application](https://stackoverflow.com/questions/28253681/you-need-to-install-postgresql-server-dev-x-y-for-building-a-server-side-extensi) – Mihai Chelaru Jul 15 '19 at 14:30

1 Answers1

2

In Ubuntu 18, install the dependency first -

sudo apt-get install libpq-dev python3-dev

And then go to your environment and install -

sudo pip install psycopg2
David Buck
  • 3,752
  • 35
  • 31
  • 35
S V Naresh
  • 89
  • 1
  • 5