Command "python setup.py egg_info" failed with error code 1 in /tmp/…./

Question:

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/
Asked By: Semnodime

||

Answers:

How to fix the 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

Explanation

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.

Answered By: Semnodime

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
Answered By: questionto42

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.

Answered By: Jesus Campon

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
Answered By: DvdG

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.

Answered By: Alejo L.A

It requires to upgrade your pip version

pip install –upgrade pip

Answered By: Manoj Parmar

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
Answered By: veben

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
Answered By: bytefish

Sometimes this error can be raised as the result of another error occurring, so if upgrading doesn’t work for you it might be worth rerunning pipenv with the –verbose option. E.g. in my case it turned out there was a problem with the scikit-image install but I could only see the error when running –verbose:

 ...
 scikit-image==0.19.1 not in cache, need to check index

INFO:pip9._vendor.requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): pypi.org
INFO:notpip.req.req_set:Collecting scikit-image==0.19.1
INFO:pip9.download:Using cached https://files.pythonhosted.org/packages/e7/54/4b57761f25be6e2536130ca3bc8742dee45bb9047c5df798197203220e37/scikit-image-0.19.1.tar.gz
INFO:pip9.download:Saved /blah/.cache/pipenv/pkgs/scikit-image-0.19.1.tar.gz
INFO:pip9.utils:Complete output from command python setup.py egg_info:
INFO:pip9.utils:Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/tmpszjqw2gobuild/scikit-image/setup.py", line 20, in <module>
    from pythran.dist import PythranBuildExt as pythran_build_ext
ModuleNotFoundError: No module named 'pythran'

----------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 82, in <module>
    main()
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 71, in main
    clear=do_clear,
  File "/usr/lib/python3/dist-packages/pipenv/resolver.py", line 63, in resolve
    verbose=verbose,
  File "/usr/lib/python3/dist-packages/pipenv/utils.py", line 425, in resolve_deps
    pre,
  File "/usr/lib/python3/dist-packages/pipenv/utils.py", line 336, in actually_resolve_reps
    resolved_tree.update(resolver.resolve(max_rounds=PIPENV_MAX_ROUNDS))
  File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/resolver.py", line 200, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/usr/lib/python3/dist-packages/pipenv/patched/piptools/resolver.py", line 297, in _iter_dependencies
    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 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python3/dist-packages/pipenv/vendor/pip9/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip9.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpszjqw2gobuild/scikit-image/
Answered By: kmt

You need to upgrade to pip9.0.3 first, and then upgrade to the latest version. The command is:

pip install pip==9.0.3
pip install --upgrade pip
Answered By: yoga333

None of the other solutions worked for me as a last resort i tried reinstalling pipenv using the command:
conda install -c conda-forge pipenv

Answered By: ACE9

See if the package you are trying to install supports your python version.

I got the same error when trying to install pygame on python3.11.1.
Turns out it was because python3.11 is not supported in pygame. Installing pygame on python3.10 worked.

Answered By: Ertugrul Gacal
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.