pip3 install -U pip check version raise ValueError Exception

Created on 23 Jan 2019  ยท  9Comments  ยท  Source: pypa/pip

Environment

  • pip version: 18.1
  • Python version: 3.6.8
  • OS: Mac OS

Description

 pip3 install -U pip
Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple
Collecting pip
  Downloading https://mirrors.tuna.tsinghua.edu.cn/pypi/web/packages/60/64/73b729587b6b0d13e690a7c3acd2231ee561e8dd28a58ae1b0409a5a2b20/pip-19.0-py2.py3-none-any.whl (1.4MB)
    100% |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 1.4MB 4.2MB/s 
Exception:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2570, in version
    return self._version
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2677, in __getattr__
    raise AttributeError(attr)
AttributeError: _version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_internal/commands/install.py", line 349, in run
    self._warn_about_conflicts(to_install)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_internal/commands/install.py", line 475, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_internal/operations/check.py", line 98, in check_install_conflicts
    package_set = create_package_set_from_installed()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_internal/operations/check.py", line 41, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip-18.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2575, in version
    raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages))
check setuptools

All 9 comments

ๆˆ‘ไนŸ้‡ๅˆฐไบ†็›ธๅŒ็š„้—ฎ้ข˜๏ผŒ้ผ“ๆฃไบ†ไธคๅฐๆ—ถๆœชๆžœใ€‚

I'm having the same problem! :(

I have met this solution for sad 3 days but solved by reinstalling:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

Collecting pip
Using cached https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-19.0.1 wheel-0.32.3

I have met this solution for sad 3 days but solved by reinstalling:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

python get-pip.py

Collecting pip
Using cached https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Installing collected packages: pip, wheel
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-19.0.1 wheel-0.32.3

It worked for me too.

Regards!

Excuse me, I still have this error following @Aazingmiao advices. But the installed package can work successfully.

pip install -U pip
Looking in indexes: https://mirrors.ustc.edu.cn/pypi/web/simple
Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (19.0.2)
Error checking for conflicts.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2584, in version
    return self._version
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2691, in __getattr__
    raise AttributeError(attr)
AttributeError: _version

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 503, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/operations/check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_internal/operations/check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2589, in version
    raise ValueError(tmpl % self.PKG_INFO, self)
ValueError: ("Missing 'Version:' header and/or METADATA file", Unknown [unknown version] (/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages))

pip version

pip -V
pip 19.0.2 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)

Getting a better error message is the subject of this setuptools issue: https://github.com/pypa/setuptools/issues/1664

Related to this, I filed a PR on setuptools' tracker to make the error message more informative: https://github.com/pypa/setuptools/pull/1706

FYI, setuptools just made a release (40.9.0) where the ValueError exception message now includes the path to the specific directory causing the problem: https://github.com/pypa/setuptools/pull/1706#issuecomment-479621881

Given the last comment and that there hasn't been any follow up questions, I think this is resolved. :)

Was this page helpful?
0 / 5 - 0 ratings