Home python Command “python setup.py egg_info” failed with error code 1

Command “python setup.py egg_info” failed with error code 1

Author

Date

Category

Installing pgAdmin 4.

pip install pgadmin4-1.1-py2-none-any.whl

And outputs this at the end

Command “python setup.py egg_info” failed with error code 1 in
/ tmp / pip-build-aofWrQ / psycopg2 /

Full text:

Collecting psycopg2 == 2.6.2 (from pgadmin4 == 1.1)
 Downloading psycopg2-2.6.2.tar.gz (376kB)
  100% | ███████████████████████████████ | 378kB 2.1MB / s
  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: pg_config executable not found.
  Please add the directory containing pg_config to the PATH
  or specify the full executable path with the option:
    python setup.py build_ext --pg-config / path / to / pg_config build ...
  or with the pg_config option in 'setup.cfg'.
  ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in / tmp / pip-build-aofWrQ / psycopg2 /

What’s written here doesn’t help, at least the first answer.


Answer 1

You don’t have psycorg2 installed (pgadmin4 dependency is likely). When installing pgadmin4, pip automatically tries to install the required dependencies (only Python libraries — pip does not install third-party non-Python software as a rule).

The error in the question arises from an attempt to compile psycorg2 from source (pg_config command not found). On my system, / usr / bin / pg_config is in the postgresql-common Ubuntu package (it doesn’t matter since the actual system install is sudo apt-get install python -psycopg2 or a similar command does).

Install psycorg2 of the correct version on your system and repeat the pip command for pgadmin4.

We are interested in the version that the pip command sees:

$ pip show psycopg2

If you want to build a newer version from source, then to automatically install dependencies for compilation, you can run:

$ sudo apt-get build-dep python-psycopg2

And rerun pip install with the desired version restrictions.


Answer 2, authority 99%

Install the following package:

sudo apt-get install libpq-dev

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions