32

I am trying to get started with downloading this project: https://github.com/sadighian/crypto-rl

And I've downloaded the packages in the requirements file but I can't figure out why the artic package won't download. I am getting this error:

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [312 lines of output]
      /Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
        error: subprocess-exited-with-error
      
        × Building wheel for numpy (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [269 lines of output]
            …
            error: Command "/opt/concourse/worker/volumes/live/c1a1a6ef-e724-4ad9-52a7-d6d68451dacb/volume/python-split_1631807121927/_build_env/bin/llvm-ar rcs build/temp.macosx-10.9-x86_64-3.9/libnpymath.a build/temp.macosx-10.9-x86_64-3.9/numpy/core/src/npymath/npy_math.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath/ieee754.o build/temp.macosx-10.9-x86_64-3.9/build/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath/npy_math_complex.o build/temp.macosx-10.9-x86_64-3.9/numpy/core/src/npymath/halffloat.o" failed with exit status 127
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for numpy
      ERROR: Failed to build one or more wheels
      Traceback (most recent call last):
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
        File "/Users/aishahalane/opt/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/aishahalane/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_p/xqkc7m_n2_ngn8wdd3pgytp80000gn/T/tmph3_m5ewf', '--quiet', 'numpy<=1.18.4']' returned non-zero exit status 1.
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/_p/xqkc7m_n2_ngn8wdd3pgytp80000gn/T/pip-req-build-s7mgwt47/setup.py", line 59, in <module>
          setup(
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/__init__.py", line 154, in setup
          _install_setup_requires(attrs)
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/__init__.py", line 148, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/dist.py", line 812, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 771, in resolve
          dist = best[req.key] = env.best_match(
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1056, in best_match
          return self.obtain(req, installer)
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1068, in obtain
          return installer(requirement)
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/dist.py", line 883, in fetch_build_egg
          return fetch_build_egg(self, req)
        File "/Users/aishahalane/venv/lib/python3.9/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
      distutils.errors.DistutilsError: Command '['/Users/aishahalane/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/_p/xqkc7m_n2_ngn8wdd3pgytp80000gn/T/tmph3_m5ewf', '--quiet', 'numpy<=1.18.4']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

How do I solve this problem?

BelKed
  • 87
  • 7
A.H
  • 441
  • 1
  • 4
  • 5

5 Answers5

64

I had this error while trying to install dotenv. With this command:

pip install dotenv

For anyone facing this error with dotenv. The right command actually is:

pip install python-dotenv
vince
  • 765
  • 3
  • 14
26

I faced a similar issue, due a recent change in pip. I solved it by adding the following to the installation command:

--use-deprecated=backtrack-on-build-failures

E.g. instead of pip install numpy I now ran:

pip install numpy --use-deprecated=backtrack-on-build-failures
Freddy Mcloughlan
  • 4,129
  • 1
  • 13
  • 29
hchw
  • 1,388
  • 8
  • 14
  • 16
    I got an error of ```option --use-deprecated: invalid choice: 'backtrack-on-build-failures' (choose from 'legacy-resolver')```. How to solve it? – Megan Jul 31 '22 at 12:43
  • 6
    @Megan I've got the same error. Use `pip install numpy --use-deprecated=legacy-resolver` instead of the `backtrack-on-build-failures` – Alexander Pranko Aug 16 '22 at 10:42
  • @AlexanderPranko. I've tried that before, but still occured an error. I've posted the question on [Error](https://stackoverflow.com/questions/73183609/error-subprocess-exited-with-error-python) too. – Megan Aug 17 '22 at 05:28
  • Actually, I solved it, but I forgot how i change/add the code:) – Megan Aug 17 '22 at 05:29
  • 3
    new versions of pip deprecated this option, so you need to make sure you are on an older version of pip – hchw Aug 17 '22 at 17:14
7

I had the same problem with metadata-generation-failed. This GitHub issue comment helped me (Ubuntu 18.04):

sudo apt-get install python-dev 
sudo apt-get install build-essential
python -m pip install -U pip or python3 -m pip install -U pip 
pip3 install --upgrade setuptools
BrokenBenchmark
  • 18,126
  • 7
  • 21
  • 33
True Seeker
  • 125
  • 1
  • 7
1

pip install numpy --use-deprecated=legacy-resolver can actually help, but there will be a red warning: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. anyway it solve my problem!

moon zfxs
  • 21
  • 1
  • This is my problem - I am getting this `metadata-generation-failed` for a dependency of the package I want to install. I was able to use `--use-deprecated=legacy-resolver` to install a more recent version of the dependency, but it still fails if I try to use it with the final package, or if I specify the version of the dependency... – Tom Wagstaff Jan 26 '23 at 15:26
1

Downgrading setuptools worked for me

pip install "setuptools<58.0.0"
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 11 '23 at 00:22