When installing packages using pip
, you might encounter the following error:
ERROR: Command errored out with exit status 1: python setup.py egg_info
Check the logs for full command output.
This error is a general error that occurs when Python fails to perform the installation you requested. The exit code 1 means Python chooses to terminate the progress because of a specific issue.
This error can happen for many reasons depending on the package you try to install.
To resolve the error, you need to look into the error message for specific details regarding your package. Let me show you two specific examples from which you can try to find yours.
1. Installing pyscopg2 package
When installing the psycopg2
package, this error might occur:
----------------------------------------
ERROR: Command errored out with exit status 1:
python setup.py egg_info Check the logs for full command output.
To see the real cause of this error, you need to look above the horizontal lines:
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. 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'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
When you read the message, the error occurs because the psycopg2
package requires the pg_config
executable file to install properly.
You can get pg_config
by installing Postgres in your system, as detailed here.
Once you have pg_config
available, run the command to install pyscopg2
package again. It should work this time.
1. Installing NumPy package
In another example, installing a specific NumPy version also give this error:
building library "npymath" sources
error: Microsoft Visual C++ 14.0 or greater is required.
Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
To resolve this error, you need to install the Microsoft Visual C++ Build Tools which you can download here.
Once the build tools are installed, run the installation command again. Notice that you didn’t receive the error this time.
Conclusion
The Python ERROR: Command errored out with exit status 1
usually occurs when the requirements to install a package are not satisfied on your system.
To resolve this error, You need to meet the requirements, like installing the required software and making it available to access from the PATH environment variable.
You need to read the error message above the exit status 1 line to figure out the real cause of this error.
I hope this tutorial is helpful. See you in other tutorials! 👋