orome
orome

Reputation: 48566

Latest 'pip' fails with "requires setuptools >= 0.8 for dist-info"

Using the recent (1.5) version of pip, I get an error when attempting to update several packages. For example, sudo pip install -U pytz results in failure with:

Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.

I don't understand this message (I have setuptools 2.1) or what to do about it.


Exception information from the log for this error:

Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 230, in run
    finder = self._build_package_finder(options, index_urls, session)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 185, in _build_package_finder
    session=session,
  File "/Library/Python/2.7/site-packages/pip/index.py", line 50, in __init__
    self.use_wheel = use_wheel
  File "/Library/Python/2.7/site-packages/pip/index.py", line 89, in use_wheel
    raise InstallationError("pip's wheel support requires setuptools >= 0.8 for dist-info support.")
InstallationError: pip's wheel support requires setuptools >= 0.8 for dist-info support.

Upvotes: 83

Views: 34239

Answers (3)

Marco Guardigli
Marco Guardigli

Reputation: 1

As a contribute to debugging efforts, I got the "AssertionError: Multiple .egg-info directories found error: subprocess-exited-with-errors" on windows python 3.11. It seems related to setuptools.

I was cleaning the c:\users<user>\appdata\local\temp but error persisted. Did not find any file/folder name matching ".egg-info" (while there are files matching "egg_info"

possibly unusual fact is that the package I am building is in drive F: while virtual env is on drive C: Paths are otherwise fine.

(venv_mfa) PS F:\pj_tpl> python -m pip install --no-cache-dir -v -e .
Using pip 23.1.2 from C:\Users\mgua0\venv_mfa\Lib\site-packages\pip (python 3.11)
Obtaining file:///F:/pj_tpl
  Running command pip subprocess to install build dependencies
  Collecting setuptools
    Using cached setuptools-67.8.0-py3-none-any.whl (1.1 MB)
  Installing collected packages: setuptools
  Successfully installed setuptools-67.8.0
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Getting requirements to build editable
  Getting requirements to build editable ... done
  Running command pip subprocess to install backend dependencies
  Collecting wheel
    Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
  Installing collected packages: wheel
  Successfully installed wheel-0.40.0
  Installing backend dependencies ... done
  Running command Preparing editable metadata (pyproject.toml)
  Traceback (most recent call last):
    File "C:\Users\mgua0\venv_mfa\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in 
      main()
    File "C:\Users\mgua0\venv_mfa\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mgua0\venv_mfa\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 181, in prepare_metadata_for_build_editable
      return hook(metadata_directory, config_settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mgua0\AppData\Local\Temp\pip-build-env-swirme89\overlay\Lib\site-packages\setuptools\build_meta.py", line 454, in prepare_metadata_for_build_editable
      return self.prepare_metadata_for_build_wheel(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mgua0\AppData\Local\Temp\pip-build-env-swirme89\overlay\Lib\site-packages\setuptools\build_meta.py", line 382, in prepare_metadata_for_build_wheel
      self._bubble_up_info_directory(metadata_directory, ".egg-info")
    File "C:\Users\mgua0\AppData\Local\Temp\pip-build-env-swirme89\overlay\Lib\site-packages\setuptools\build_meta.py", line 353, in _bubble_up_info_directory
      info_dir = self._find_info_directory(metadata_directory, suffix)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\mgua0\AppData\Local\Temp\pip-build-env-swirme89\overlay\Lib\site-packages\setuptools\build_meta.py", line 364, in _find_info_directory
      assert len(candidates) == 1, f"Multiple {suffix} directories found"
             ^^^^^^^^^^^^^^^^^^^^
  AssertionError: Multiple .egg-info directories found
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: 'C:\Users\mgua0\venv_mfa\Scripts\python.exe' 'C:\Users\mgua0\venv_mfa\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py' prepare_metadata_for_build_editable 'C:\Users\mgua0\AppData\Local\Temp\tmpxmnvgja0'
  cwd: F:\pj_tpl
  Preparing editable metadata (pyproject.toml) ... error
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.
(venv_mfa) PS F:\pj_tpl>

Upvotes: 0

Rolandf
Rolandf

Reputation: 1657

This worked for me:

sudo pip install setuptools --no-use-wheel --upgrade

Note it's usage of sudo

UPDATE

On Windows you just need to execute pip install setuptools --no-use-wheel --upgrade as an administrator. In Unix/Linux, the sudo command is for elevating permissions.

UPDATE 2

This appears to have been fixed in 1.5.1.

Upvotes: 148

user1503941
user1503941

Reputation: 446

First, you should never run 'sudo pip'.

If possible you should use your system package manager because it uses GPG signatures to ensure you're not running malicious code.

Otherwise, try upgrading setuptools:

easy_install -U setuptools

Alternatively, try:

pip install --user <somepackage>

This is of course for "global" packages. You should ideally be using virtualenvs.

Upvotes: 11

Related Questions