python 3.x – distutils.errors.DistutilsError: Command . . . returned non-zero exit status 1

Ubuntu 20.04.4 LTS, pyenv 2.3.1, python3-distutils 3.8.10-0ubuntu1~20.04, libffi-dev 3.3-4, setuptools 58.1.0, pip-22.1.2

machine@machine-HP-ProBook-9000: ~$ pyenv virtualenv 3.11.0b3 Project-Python-env-3.11.0b3

machine@machine-HP-ProBook-9000:~$ pyenv activate Project-Python-env-3.11.0b3 pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1′ to simulate the behavior. (Project-Python-env-3.11.0b3)

machine@machine-HP-ProBook-9000:~$ pip install -r requirements.txt

Collecting pyblake2>=1.1.2
  Using cached pyblake2-1.1.2.tar.gz (126 kB)
  Preparing metadata (setup.py) ... done
Collecting pycares>=4.1.2
  Using cached pycares-4.1.2.tar.gz (819 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [63 lines of output]
      /home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The wheel package is not available.
        error: subprocess-exited-with-error
      
        × python setup.py bdist_wheel did not run successfully.
        │ exit code: 1
        ╰─> [8 lines of output]
            /home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/config/setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
              warnings.warn(msg, warning_class)
            usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
               or: setup.py --help [cmd1 cmd2 ...]
               or: setup.py --help-commands
               or: setup.py cmd --help
      
            error: invalid command 'bdist_wheel'
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for cffi
      ERROR: Failed to build one or more wheels
      Traceback (most recent call last):
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
          subprocess.check_call(cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/lib/python3.11/subprocess.py", line 402, in check_call
          raise CalledProcessError(retcode, cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      subprocess.CalledProcessError: Command '['/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/bin/python3.11', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpch95iqfv', '--quiet', 'cffi>=1.5.0']' 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 "/tmp/pip-install-xzs1doxe/pycares_3c3b9d14edf54f9ba1f73cf8a78f57fd/setup.py", line 16, in <module>
          setup(name="pycares",
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/__init__.py", line 86, in setup
          _install_setup_requires(attrs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
          dist.fetch_build_eggs(dist.setup_requires)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/dist.py", line 876, in fetch_build_eggs
          resolved_dists = pkg_resources.working_set.resolve(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 789, in resolve
          dist = best[req.key] = env.best_match(
                                 ^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1075, in best_match
          return self.obtain(req, installer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1087, in obtain
          return installer(requirement)
                 ^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/dist.py", line 956, in fetch_build_egg
          return fetch_build_egg(self, req)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/lib/python3.11/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
          raise DistutilsError(str(e)) from e
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      distutils.errors.DistutilsError: Command '['/home/machine/.pyenv/versions/3.11.0b3/envs/Project-Python-env-3.11.0b3/bin/python3.11', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpch95iqfv', '--quiet', 'cffi>=1.5.0']' 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.
hint: See above for details.

How do I resolve this issue?

Leave a Comment