I got the following error installing a dependency with pip:
pip9.exceptions.InstallationError Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpoons7qgkbuild/opencv-python/
Below is the result of running the command pipenv install opencv-python
on a recent linux (5.4.0 x64) system.
Locking [packages] dependencies…
self.repository.get_dependencies(ireq):
File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 174, in get_dependencies
legacy_results = self.get_legacy_dependencies(ireq)
File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/repositories/pypi.py", line 222, in get_legacy_dependencies
result = reqset._prepare_file(self.finder, ireq, ignore_requires_python=True)
File "/usr/lib/python3/dist-packages/pipenv/patched/notpip/req/req_set.py", line 644, in _prepare_file
abstract_dist.prep_for_dist()
File "/usr/lib/python3/dist-packages/pipenv/patched/notpip/req/req_set.py", line 134, in prep_for_dist
self.req_to_install.run_egg_info()
File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/req/req_install.py", line 435, in run_egg_info
call_subprocess(
File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/utils/__init__.py", line 705, in call_subprocess
raise InstallationError(
pip9.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpoons7qgkbuild/opencv-python/
Santiago Trujillo
In a project that needs Python2 and pip2, I got the similar error
python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hI6hg8/mpmath/
In the following, "python-pip" is pip2 (python3-pip would be pip3):
apt-get install --upgrade python-pip -y && \
python -m pip install --upgrade pip
I am not sure whether the second --upgrade
is needed, though it does not harm either, the code worked for me.
And then I installed the packages with apt (= apt-get) in as many cases as possible. I checked package by package, example from a Dockerfile:
RUN apt-get install -y python-scipy
RUN apt-get install -y python-sympy
...
RUN python -m pip install opencv-python==3.4.0.12
RUN python -m pip install pyyaml
...
That means: I search for the apt Python2 installer (usually just python-PACKAGENAME, while python3-PACKAGENAME would be for Python3), and if there is none, I take the python -m pip installer (=Python2 as well). After all testing, I put them together in two RUN commands, but that is a side-node for the Dockerfile users.
In any case. Do not use just pip install
, since that will call your default pip, and that might fall on a higher version if you have pip3 installed. Even if not, it is clearer to always use python -m pip
so that there is no confusion in the future, if pip3 gets installed later.
Without having tested this, the error of the question is perhaps caused by a pip2 that is asked to install a too recent version of "opencv-python". Then you need to limit "opencv-python" to the latest version available in Python2, which is version 3.4.0.12:
python -m pip install opencv-python==3.4.0.12
I hava a same problem.
When I execute:
pip install jupyterlab
it throw an error:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-p0u6Wd/jupyterlab
I try many ways, they all failed.
Finaly, I find there is an anther pip in my computer:
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
$ pip3 --version
pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
I use pip3
fix the problem:
pip3 install jupyterlab
For me, none of the previous worked. The solution was to force the upgrade of pip since the upgrade was inside of the version and not the current one, e.i, it was something like 9.0.1 but the new one is 21.1.3
python -m pip install --upgrade --force pip
pip3 install --upgrade setuptools
and then retry the installation. I also update wheel
along the way.
It requires to upgrade your pip version
pip install --upgrade pip
For python 3.7, I have to execute the following commands to update pip
and setuptools
dependencies:
sudo python3.7 -m pip install -U pip
sudo python3.7 -m pip install -U setuptools
For python 2.7, I have to update pip
and setuptools
dependencies AND have to install python-dev
& libpq-dev
packages:
sudo python2.7 -m pip install -U pip
sudo python2.7 -m pip install -U setuptools
sudo apt-get install python-dev libpq-dev
I just ran into a similar problem when trying to install the Google Cloud Platform package for BigQuery on Python 3.6 which was throwing me the following error: (couldn't copy and paste before I lost it, so this is a approximation of the exact error I got)
[...]InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/<some_folder>/grpcio/
And after following other threads with the most recommended options to upgrade the setuptools, not using the cached packages, using the local user option, etc... Nothing worked
python3 -m pip install --user --no-cache-dir google-cloud-bigquery
python3 -m pip install --upgrade setuptools
Then, when looking a bit more carefully into the actual error message, I could see that the failing line was also referring to what I thought may be another dependency package: grpcio
So sure enought, I thought about trying also to upgrade or re-install that grpcio package and see what would happen.
I tried first with just upgrading that package:
python3 -m pip install --no-cache-dir --user --upgrade grpcio
And it did upgrade fine. So next I tried to upgrade the google-cloud-bigquery package again, and this time around it also worked perfectly and that solved the problem!
So basically it seems that ensuring the whole dependency chain is available and installed properly may do the trick as well, which makes total sense when you think about it
I hope this helps some people.
I solved a similar issue following this link https://www.edureka.co/community/69396/command-python-setup-info-failed-error-build-8nhf9w2t-grpcio and using the following command:
$ pip3 install --upgrade setuptools
$ pip3 install --upgrade pip
pip9.exceptions.InstallationError
Make sure the version of your pip
and setuptools
is sufficient for manylinux2014 wheels
.
A) System Install
sudo python3 -m pip install -U pip
sudo python3 -m pip install -U setuptools
B) Virtual Env / Pipenv
# Within the venv
pip3 install -U pip
pip3 install -U setuptools
For me, python setup.py egg_info
probably failed because of a recent change in python wheels, as manylinux1 wheels
were replaced by manylinux2014 wheels
according to open-cv faq.