Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip19.0.1 list error"AttributeError: _version" #6194

Closed
zhouyu328 opened this issue Jan 24, 2019 · 32 comments · Fixed by #6225
Closed

pip19.0.1 list error"AttributeError: _version" #6194

zhouyu328 opened this issue Jan 24, 2019 · 32 comments · Fixed by #6225
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Milestone

Comments

@zhouyu328
Copy link

Environment

  • pip version:19.0.1
  • Python version:3.7
  • OS:MacOS

I update pip from 10.1 to 19.0.1, and I wanna check my python packages, I input "pip list" then two errors occurred.
Description

Expected behavior

Exception:
Traceback (most recent call last):
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/pip/_vendor/pkg_resources/init.py", line 2584, in version
return self._version
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/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 "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 176, in main
status = self.run(options, args)
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 148, in run
self.output_package_listing(packages, options)
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 205, in output_package_listing
data, header = format_for_columns(packages, options)
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/pip/_internal/commands/list.py", line 271, in format_for_columns
row = [proj.project_name, proj.version]
File "/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/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] (/usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages))
How to Reproduce

  1. Get package from '...'
  2. Then run '...'
  3. An error occurs.

Output

Paste the output of the steps above, including the commands themselves and
pip's output/traceback etc.
@RonnyPfannschmidt
Copy link
Contributor

there seems to be completely broken metadata in your python installation - can you try to run pip in pdb and get the project name/location, perhaps the metadata folder to see whats messing things up?

@jerbob
Copy link

jerbob commented Jan 25, 2019

@zhouyu328 What's the output of the following command?

find /usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/ -name METADATA

@0000matteo0000
Copy link

0000matteo0000 commented Jan 25, 2019

so i have been having the same probem so i experimented a bit and i think this could help:
i edited:
~/.local/lib/python3.6/site-packages/pip/_vendor/pkg_resources/init.py
and added just before line 2589 a print so it looks like this
@property def version(self): try: return self._version except AttributeError: version = _version_from_file(self._get_metadata(self.PKG_INFO)) if version is None: print(self._provider.__dict__) #this tmpl = "Missing 'Version:' header and/or %s file" raise ValueError(tmpl % self.PKG_INFO, self) return version
the self is a object filled with None and Unknown data:
{'project_name': 'Unknown', 'py_version': None, 'platform': None, 'location': '~/.local/lib/python3.6/site-packages', 'precedence': -1, '_provider': <pip._vendor.pkg_resources.PathMetadata object at 0x7f0faa49d4e0>, '_key': 'unknown'} {'project_name': 'Unknown', 'py_version': None, 'platform': None, 'location': '~/.local/lib/python3.6/site-packages', 'precedence': -1, '_provider': <pip._vendor.pkg_resources.PathMetadata object at 0x7f0faa49d4e0>, '_key': 'unknown'}

but the _provider returns this:
{'module_path': '~/.local/lib/python3.6/site-packages', 'egg_info': '~/.local/lib/python3.6/site-packages/-rpcio-1.18.0.dist-info'} {'module_path': '~/.local/lib/python3.6/site-packages', 'egg_info': '~/.local/lib/python3.6/site-packages/-rpcio-1.18.0.dist-info'}

no idea why it's printed twice in both cases
i checked with
sudo apt install python3-grpcio
and i have it installed

@0000matteo0000
Copy link

0000matteo0000 commented Jan 25, 2019

@zhouyu328 What's the output of the following command?

find /usr/local/var/pyenv/versions/3.7.0/lib/python3.7/site-packages/ -name METADATA

in my ~/.local/lib/python3.6/site-packages, but there are more folders han that and many have the samename but without the version.dist-info:

./pip-19.0.1.dist-info/METADATA
./lxml-4.3.0.dist-info/METADATA
./pickleshare-0.7.5.dist-info/METADATA
./asn1crypto-0.24.0.dist-info/METADATA
./keyrings.alt-3.1.1.dist-info/METADATA
./certifi-2018.10.15.dist-info/METADATA
./autopep8-1.4.3.dist-info/METADATA
./Pygments-2.3.1.dist-info/METADATA
./cligj-0.5.0.dist-info/METADATA
./jsonschema-2.6.0.dist-info/METADATA
./labelImg-1.8.1.dist-info/METADATA
./contextlib2-0.5.5.dist-info/METADATA
./pymacaroons-0.13.0.dist-info/METADATA
./six-1.10.0.dist-info/METADATA
./Glances-3.1.0.dist-info/METADATA
./cryptography-2.5.dist-info/METADATA
./mccabe-0.6.1.dist-info/METADATA
./jsoncomment-0.3.0.dist-info/METADATA
./ipykernel-5.1.0.dist-info/METADATA
./enum34-1.1.6.dist-info/METADATA
./docopt-0.6.2.dist-info/METADATA
./nbformat-4.4.0.dist-info/METADATA
./sympy-1.3.dist-info/METADATA
./cloudpickle-0.7.0.dist-info/METADATA
./pydocstyle-3.0.0.dist-info/METADATA
./wheel-0.32.3.dist-info/METADATA
./absl_py-0.7.0.dist-info/METADATA
./autokeras-0.3.6.dist-info/METADATA
./keyring-17.1.1.dist-info/METADATA
./grpcio_tools-1.10.1.dist-info/METADATA
./SecretStorage-3.1.1.dist-info/METADATA
./lws-1.2.dist-info/METADATA
./pyquery-1.4.0.dist-info/METADATA
./jeepney-0.4.dist-info/METADATA
./Keras_Preprocessing-1.0.2.dist-info/METADATA
./yarg-0.1.9.dist-info/METADATA
./blinker-1.4.dist-info/METADATA
./psutil-5.5.0.dist-info/METADATA
./libmagic-1.0.dist-info/METADATA
./h5py-2.9.0.dist-info/METADATA
./python_magic-0.4.15.dist-info/METADATA
./jupyter_console-6.0.0.dist-info/METADATA
./Click-7.0.dist-info/METADATA
./mistune-0.8.4.dist-info/METADATA
./pyflakes-2.0.0.dist-info/METADATA
./audioread-2.1.6.dist-info/METADATA
./inflect-2.1.0.dist-info/METADATA
./EbookLib-0.17.1.dist-info/METADATA
./networkx-2.2.dist-info/METADATA
./click_plugins-1.0.4.dist-info/METADATA
./grpcio-1.0.0.dist-info/METADATA
./unicode_slugify-0.1.3.dist-info/METADATA
./six-1.12.0.dist-info/METADATA
./scipy-1.2.0.dist-info/METADATA
./macaroonbakery-1.2.1.dist-info/METADATA
./tensorboard-1.12.0.dist-info/METADATA
./llvmlite-0.27.0.dist-info/METADATA
./qtconsole-4.4.3.dist-info/METADATA
./wcwidth-0.1.7.dist-info/METADATA
./requests-2.21.0.dist-info/METADATA
./ptyprocess-0.6.0.dist-info/METADATA
./pipreqs-0.4.9.dist-info/METADATA
./torchvision-0.2.1.dist-info/METADATA
./rope-0.11.0.dist-info/METADATA
./testpath-0.4.2.dist-info/METADATA
./pystache-0.5.4.dist-info/METADATA
./olefile-0.46.dist-info/METADATA
./Werkzeug-0.14.1.dist-info/METADATA
./defusedxml-0.5.0.dist-info/METADATA
./jupyter-1.0.0.dist-info/METADATA
./scikit_learn-0.20.2.dist-info/METADATA
./soupsieve-1.7.3.dist-info/METADATA
./pyRFC3339-1.1.dist-info/METADATA
./docker-3.7.0.dist-info/METADATA
./librosa-0.6.2.dist-info/METADATA
./cycler-0.10.0.dist-info/METADATA
./singledispatch-3.4.0.3.dist-info/METADATA
./python_language_server-0.22.0.dist-info/METADATA
./imageio-2.4.1.dist-info/METADATA
./influxdb-5.2.1.dist-info/METADATA
./pyflakes-2.1.0.dist-info/METADATA
./nbconvert-5.4.0.dist-info/METADATA
./backcall-0.1.0.dist-info/METADATA
./traitlets-4.3.2.dist-info/METADATA
./python_pptx-0.6.17.dist-info/METADATA
./bleach-3.1.0.dist-info/METADATA
./Keras-2.2.4.dist-info/METADATA
./cssselect-1.0.3.dist-info/METADATA
./joblib-0.13.1.dist-info/METADATA
./PyQt5_sip-4.19.13.dist-info/METADATA
./termcolor-1.1.0.dist-info/METADATA
./gast-0.2.2.dist-info/METADATA
./PyQt5-5.10.1.dist-info/METADATA
./argcomplete-1.9.4.dist-info/METADATA
./pluggy-0.8.1.dist-info/METADATA
./tensorboard-1.10.0.dist-info/METADATA
./urllib3-1.24.1.dist-info/METADATA
./Mako-1.0.7.dist-info/METADATA
./jupyter_core-4.4.0.dist-info/METADATA
./ipywidgets-7.4.2.dist-info/METADATA
./pyxdg-0.26.dist-info/METADATA
./simplejson-3.16.0.dist-info/METADATA
./Markdown-3.0.1.dist-info/METADATA
./tornado-5.1.1.dist-info/METADATA
./pandas-0.23.4.dist-info/METADATA
./louis-1.3.dist-info/METADATA
./pyinotify-0.9.6.dist-info/METADATA
./chardet-2.3.0.dist-info/METADATA
./netifaces-0.10.9.dist-info/METADATA
./yapf-0.25.0.dist-info/METADATA
./simplegeneric-0.8.1.dist-info/METADATA
./python_debian-0.1.34.dist-info/METADATA
./chardet-3.0.4.dist-info/METADATA
./httplib2-0.12.0.dist-info/METADATA
./python_jsonrpc_server-0.0.2.dist-info/METADATA
./widgetsnbextension-3.4.2.dist-info/METADATA
./prometheus_client-0.5.0.dist-info/METADATA
./sip-4.19.8.dist-info/METADATA
./mock-2.0.0.dist-info/METADATA
./pytesseract-0.2.5.dist-info/METADATA
./requests_file-1.4.3.dist-info/METADATA
./Keras_Preprocessing-1.0.5.dist-info/METADATA
./ipython-7.2.0.dist-info/METADATA
./lazr.uri-1.0.3.dist-info/METADATA
./requests_unixsocket-0.1.5.dist-info/METADATA
./notebook-5.7.4.dist-info/METADATA
./pytesseract-0.2.6.dist-info/METADATA
./Flask-1.0.2.dist-info/METADATA
./pycocotools-2.0.0.dist-info/METADATA
./pocketsphinx-0.1.15.dist-info/METADATA
./distro-1.3.0.dist-info/METADATA
./isort-4.3.4.dist-info/METADATA
./pysnmp-4.4.8.dist-info/METADATA
./pyparsing-2.3.1.dist-info/METADATA
./pycups-1.9.74.dist-info/METADATA
./PyJWT-1.7.1.dist-info/METADATA
./resampy-0.2.1.dist-info/METADATA
./xlrd-1.2.0.dist-info/METADATA
./snowballstemmer-1.2.1.dist-info/METADATA
./autopep8-1.4.2.dist-info/METADATA
./pycairo-1.18.0.dist-info/METADATA
./lazr.restfulclient-0.14.2.dist-info/METADATA
./tldextract-2.2.0.dist-info/METADATA
./snuggs-1.4.2.dist-info/METADATA
./launchpadlib-1.10.6.dist-info/METADATA
./jedi-0.13.2.dist-info/METADATA
./scour-0.37.dist-info/METADATA
./futures-3.1.1.dist-info/METADATA
./sshuttle-0.78.4.dist-info/METADATA
./Cython-0.29.3.dist-info/METADATA
./websocket_client-0.54.0.dist-info/METADATA
./SpeechRecognition-3.8.1.dist-info/METADATA
./GPUtil-1.4.0.dist-info/METADATA
./python_pptx-0.6.5.dist-info/METADATA
./configparser-3.5.0.dist-info/METADATA
./ply-3.11.dist-info/METADATA
./PyOpenGL-3.1.0.dist-info/METADATA
./pyzmq-17.1.2.dist-info/METADATA
./decorator-4.3.2.dist-info/METADATA
./pytz-2018.9.dist-info/METADATA
./binwalk-2.1.0.dist-info/METADATA
./PyYAML-3.13.dist-info/METADATA
./terminado-0.8.1.dist-info/METADATA
./python_jsonrpc_server-0.1.2.dist-info/METADATA
./torch-1.0.0.dist-info/METADATA
./pyqtgraph-0.10.0.dist-info/METADATA
./tensorflow-1.12.0.dist-info/METADATA
./prompt_toolkit-2.0.7.dist-info/METADATA
./cffi-1.11.5.dist-info/METADATA
./numpy-1.16.0.dist-info/METADATA
./youtube_dl-2019.1.24.dist-info/METADATA
./selenium-3.141.0.dist-info/METADATA
./wheel-0.32.2.dist-info/METADATA
./XlsxWriter-1.1.2.dist-info/METADATA
./pyparsing-2.3.0.dist-info/METADATA
./tensorflow-1.10.0.dist-info/METADATA
./Unidecode-1.0.23.dist-info/METADATA
./Jinja2-2.10.dist-info/METADATA
./bleach/_vendor/html5lib-1.0.1.dist-info/METADATA
./pbr-5.1.1.dist-info/METADATA
./textract-1.6.1.dist-info/METADATA
./docx2txt-0.7.dist-info/METADATA
./pysmi-0.3.3.dist-info/METADATA
./pocketsphinx-0.1.3.dist-info/pocketsphinx-0.1.3.dist-info/METADATA
./PyWavelets-1.0.1.dist-info/METADATA
./jupyter_client-5.2.4.dist-info/METADATA
./tqdm-4.29.1.dist-info/METADATA
./webencodings-0.5.1.dist-info/METADATA
./setuptools-40.6.3.dist-info/METADATA
./selenium_requests-1.3.dist-info/METADATA
./lightgbm-2.2.2.dist-info/METADATA
./oauthlib-3.0.1.dist-info/METADATA
./numba-0.42.0.dist-info/METADATA
./PyNaCl-1.3.0.dist-info/METADATA
./Keras_Applications-1.0.4.dist-info/METADATA
./defer-1.0.4.dist-info/METADATA
./xlrd-1.0.0.dist-info/METADATA
./ipython_genutils-0.2.0.dist-info/METADATA
./rasterio-1.0.10.dist-info/METADATA
./dask-1.1.0.dist-info/METADATA
./reportlab-3.5.13.dist-info/METADATA
./distro_info-0.0.0.dist-info/METADATA
./setuptools-39.1.0.dist-info/METADATA
./-rpcio-1.18.0.dist-info/grpcio-1.18.0.dist-info/METADATA
./rasterio-1.0.13.dist-info/METADATA
./MarkupSafe-1.1.0.dist-info/METADATA
./protobuf-3.6.1.dist-info/METADATA
./wadllib-1.3.3.dist-info/METADATA
./affine-2.2.2.dist-info/METADATA
./testresources-2.0.1.dist-info/METADATA
./future-0.17.1.dist-info/METADATA
./pyxattr-0.6.1.dist-info/METADATA
./docker_pycreds-0.4.0.dist-info/METADATA
./certifi-2018.11.29.dist-info/METADATA
./matplotlib-3.0.2.dist-info/METADATA
./beautifulsoup4-4.5.3.dist-info/METADATA
./mpmath-1.1.0.dist-info/METADATA
./Send2Trash-1.5.0.dist-info/METADATA
./itsdangerous-1.1.0.dist-info/METADATA
./Keras_Applications-1.0.6.dist-info/METADATA
./SpeechRecognition-3.6.3.dist-info/METADATA
./html5lib-1.0.1.dist-info/METADATA
./idna-2.8.dist-info/METADATA
./toolz-0.9.0.dist-info/METADATA
./pycparser-2.19.dist-info/METADATA
./kiwisolver-1.0.1.dist-info/METADATA
./entrypoints-0.3.dist-info/METADATA
./tensorboard-1.12.2.dist-info/METADATA
./pycodestyle-2.4.0.dist-info/METADATA
./astor-0.7.1.dist-info/METADATA
./pycryptodomex-3.7.3.dist-info/METADATA
./python_language_server-0.21.2.dist-info/METADATA
./PyGObject-3.30.4.dist-info/METADATA
./scikit_image-0.14.2.dist-info/METADATA
./pycrypto-2.6.1.dist-info/METADATA
./opencv_python-4.0.0.21.dist-info/METADATA
./bottle-0.12.16.dist-info/METADATA
./attrs-18.2.0.dist-info/METADATA
./pandocfilters-1.4.2.dist-info/METADATA
./pexpect-4.6.0.dist-info/METADATA
./pyasn1-0.4.5.dist-info/METADATA
./parso-0.3.2.dist-info/METADATA
./numpy-1.14.5.dist-info/METADATA
./nltk-3.4.dist-info/METADATA
./Pillow-5.4.1.dist-info/METADATA
./beautifulsoup4-4.7.1.dist-info/METADATA
./python_dateutil-2.7.5.dist-info/METADATA

@jerbob
Copy link

jerbob commented Jan 25, 2019

These don't look right...

./pocketsphinx-0.1.3.dist-info/pocketsphinx-0.1.3.dist-info/METADATA
./-rpcio-1.18.0.dist-info/grpcio-1.18.0.dist-info/METADATA

@jerbob
Copy link

jerbob commented Jan 25, 2019

@0000matteo0000 Does this fix your issue?

mv pocketsphinx-0.1.3.dist-info p; mv p/pocketsphinx-0.1.3.dist-info .; rm -r p
mv -rpcio-1.18.0.dist-info r; mv r/grpcio-1.18.0.dist-info .; rm -r r

@0000matteo0000
Copy link

@0000matteo0000 Does this fix your issue?

mv pocketsphinx-0.1.3.dist-info p; mv p/pocketsphinx-0.1.3.dist-info .; rm -r p
mv -rpcio-1.18.0.dist-info r; mv r/grpcio-1.18.0.dist-info .; rm -r r

yup thanks, i moved those and i had to also move pip itself but that fixed it it seems, could there be a bug in pip so that packages are put in the wrong folders? because i never moved anything around there

@cjerdonek
Copy link
Member

@uranusjr Do you know why packages might be getting installed with a leading hyphen? See the comment above (-rpcio instead of grpcio). Here is another example (-onfigparser): #6169 (comment)

@uranusjr
Copy link
Member

Hmm, no, nothing from the top of my head. I also tried but failed to reproduce this on various environments (Python 2.7/3.7, Mac/Windows, pip 19.0.0/19.0.1, venv/global). This seems to be a very specific problem :|

@0000matteo0000
Copy link

0000matteo0000 commented Jan 26, 2019

might be related, i use this script to update all pip packages

#!/bin/bash
#pip install --user --upgrade --force-reinstall --ignore-installed pip
pip install --user --upgrade pip
p=$(pip list | awk 'NR>2, ORS=" " {print $1;}')
#pip install --user --upgrade --force-reinstall --ignore-installed $p
pip install --user --upgrade $p

but if it mangled package names pip would just stop say package not found
and used the force reinstall and ignore installed commands on multiple packages trying to fix the "failed to import main from package pip" when i try to run it as sudo.
no problem running pip from the root user though

@trohit920
Copy link

trohit920 commented Jan 30, 2019

I am also getting some error using pip freeze. I am using windows 10, python 3.6.0 and pip version is 19.0.1. Please take a look:

`Error checking for conflicts.
Traceback (most recent call last):
  File "c:\users\rohit\appdata\local\programs\python\python36\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2584, in version
    return self._version
  File "c:\users\rohit\appdata\local\programs\python\python36\lib\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 "c:\users\rohit\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 503, in _warn_about_conflicts
    package_set, _dep_info = check_install_conflicts(to_install)
  File "c:\users\rohit\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\operations\check.py", line 108, in check_install_conflicts
    package_set, _ = create_package_set_from_installed()
  File "c:\users\rohit\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\operations\check.py", line 47, in create_package_set_from_installed
    package_set[name] = PackageDetails(dist.version, dist.requires())
  File "c:\users\rohit\appdata\local\programs\python\python36\lib\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] (c:\users\rohit\appdata\local\programs\python\python36\lib\site-packages))`

Any help will be appreciated.

@cjerdonek
Copy link
Member

cjerdonek commented Jan 30, 2019

A couple comments:

@zooba
Copy link
Contributor

zooba commented Jan 30, 2019

The nested .dist-info directories is I think the last issue I'm working on in my PR.

Is pkg_resources allowing leading hyphen in package names? That's easily fixed by removing it from the "valid/invalid" character list.

@cjerdonek
Copy link
Member

Is pkg_resources allowing leading hyphen in package names?

I was guessing that issue might be on the pip side (e.g. pip deciding when to call pkg_resources). (I also meant to mention this point in my previous comment.) Or perhaps it could even be both maybe. Either way, it's another thing to look into as a follow-up to this issue.

@SterlingButters
Copy link

SterlingButters commented Jan 30, 2019

I too am getting the initial error mentioned by @zhouyu328. On inspection, the following packages of mine have a leading hyphen introduced:

-_pycache__
-ecorator-4.3.0.dist-info
-ix-1.11.0.dist-info
-plotly_utils
-uartz
-ynput-1.3.10.dist-info
-ytz-2018.5.dist-info

I, too, use a script to update all packages:
sudo -H /Users/sterlingbutters/anaconda3/bin/pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 /Users/sterlingbutters/anaconda3/bin/pip install -U

Would appreciate info on fixing the now-broken configuration (I'm scared mostly to mess with the __pycache__ dir)

@cjerdonek cjerdonek added the type: bug A confirmed bug or unintended behavior label Jan 30, 2019
@0000matteo0000
Copy link

0000matteo0000 commented Jan 30, 2019

the worst thing is terminals and pip itself will fail with packages starting with an hyphen because they will treat it as a parameter.
could some of the parameters given with double hyphen be badly interpreted so that one of them ends up in the package name?
also some packages got moved inside their own directory for some reason
and to me this happened just after the update to pip 19 from 18, if there are scripts managing the update of pip's environment from one to the other maybe the problem could lie there

@zooba
Copy link
Contributor

zooba commented Jan 30, 2019

the worst thing is terminals and pip itself will fail with packages starting with an hyphen because they will treat it as a parameter.

That's a very good point that I hadn't thought of. I'll drop the hyphen as a potential replacement character.

zooba added a commit to zooba/pip that referenced this issue Jan 30, 2019
@pradyunsg pradyunsg added this to the 19.0 milestone Jan 31, 2019
@longbowking
Copy link

I got the same problem in my mac. The original pip was installed along with python3 through brew install python3 and works well. After i tried to update pip by pip3 install -U pip , pip commands(pip list) start to raise those exceptions.
The discussion above give me a hint to check whether broken project exists in my site-packages folder or not.

  • Since pip --version shows pip 19.0.1 from /usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6), i went into the folder and tried to find some folders starting with '-' with no luck.
  • It is frustrating that the error message is not enough to locate the exact problem, so i decided to debug it to get details, .., here we go:
#pip/_vendor/pkg_resources/__init__.py
    @property
    def version(self):
        try:
            print('-'*50)
            print(self.project_name)
            print(self.location)
            print(self._version)
            # print(self.project_name, self._version, self.location)
            return self._version
        except AttributeError:
            version = _version_from_file(self._get_metadata(self.PKG_INFO))
            if version is None:
                print('Something wrong exists in:', self.project_name)
                tmpl = "Missing 'Version:' header and/or %s file"
                raise ValueError(tmpl % self.PKG_INFO, self)
            return version

then pip list outputs:

. . .
--------------------------------------------------
Unknown
/Users/king/Library/Python/3.6/lib/python/site-packages
Something wrong exists in Unknown

I realized that broken packages may exist in /Users/king/Library/Python/3.6/lib/python/site-packages and it does in fact. After i remove broken packages in this folder, pip comes back to life!

@cjerdonek
Copy link
Member

It is frustrating that the error message is not enough to locate the exact problem,

Yes, this is why I said above that an issue should probably be filed with pkg_resources.

@pradyunsg
Copy link
Member

Maybe someone can file an issue there.

Did that: pypa/setuptools#1664

@MichaelXoXo
Copy link

I had the same problem,and run the command mv /usr/lib/python2.7/site-packages/-br-1.10.0.dist-info /usr/lib/python2.7/site-packages/pbr-1.10.0.dist-info to solve the problem.

However, what's the real reason for the problem?

@cjerdonek
Copy link
Member

However, what's the real reason for the problem?

The root cause will be solved by PR #6225.

@uluQulu
Copy link

uluQulu commented Feb 9, 2019

These don't look right...
./pocketsphinx-0.1.3.dist-info/pocketsphinx-0.1.3.dist-info/METADATA
./-rpcio-1.18.0.dist-info/grpcio-1.18.0.dist-info/METADATA

@anonguy thanks a lot 🙌🏼
-rpcio with a dash was making the problem..

bors bot referenced this issue in mozilla/normandy Feb 11, 2019
1726: Update python:3.7-slim Docker digest to 8a125f6 r=peterbe a=renovate[bot]

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| python | digest | `3.7-slim` -> `8a125f6` |


1732: Scheduled weekly dependency update for week 06 r=peterbe a=pyup-bot






### Update [botocore](https://pypi.org/project/botocore) from **1.12.86** to **1.12.91**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.12.91
   ```
   =======

* api-change:``discovery``: Update discovery client to latest version
* api-change:``ecs``: Update ecs client to latest version
* api-change:``dlm``: Update dlm client to latest version
   ```
   
  
  
   ### 1.12.90
   ```
   =======

* api-change:``es``: Update es client to latest version
* api-change:``medialive``: Update medialive client to latest version
* api-change:``gamelift``: Update gamelift client to latest version
* api-change:``robomaker``: Update robomaker client to latest version
   ```
   
  
  
   ### 1.12.89
   ```
   =======

* api-change:``ec2``: Update ec2 client to latest version
* api-change:``fsx``: Update fsx client to latest version
   ```
   
  
  
   ### 1.12.88
   ```
   =======

* api-change:``shield``: Update shield client to latest version
* api-change:``servicecatalog``: Update servicecatalog client to latest version
* api-change:``ec2``: Update ec2 client to latest version
   ```
   
  
  
   ### 1.12.87
   ```
   =======

* api-change:``ecs``: Update ecs client to latest version
* api-change:``application-autoscaling``: Update application-autoscaling client to latest version
* api-change:``workspaces``: Update workspaces client to latest version
* api-change:``codecommit``: Update codecommit client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/botocore
  - Changelog: https://pyup.io/changelogs/botocore/
  - Repo: https://github.com/boto/botocore
</details>





### Update [python-dateutil](https://pypi.org/project/python-dateutil) from **2.7.5** to **2.8.0**.


<details>
  <summary>Changelog</summary>
  
  
   ### 2.8.0
   ```
   ==========================

Data updates
------------

- Updated tzdata version to to 2018i.


Features
--------

- Added support for ``EXDATE`` parameters when parsing ``rrule`` strings.
  Reported by mlorant (gh issue 410), fixed by nicoe (gh pr 859).
- Added support for sub-minute time zone offsets in Python 3.6+.
  Fixed by cssherry (gh issue 582, pr 763)
- Switched the ``tzoffset``, ``tzstr`` and ``gettz`` caches over to using weak
  references, so that the cache expires when no other references to the
  original ``tzinfo`` objects exist. This cache-expiry behavior is not
  guaranteed in the public interface and may change in the future. To improve
  performance in the case where transient references to the same time zones
  are repeatedly created but no strong reference is continuously held, a
  smaller &quot;strong value&quot; cache was also added. Weak value cache implemented by
  cs-cordero (gh pr 672, 801), strong cache added by
  Gökçen Nurlu (gh issue 691, gh pr 761)


Bugfixes
--------

- Added time zone inference when initializing an ``rrule`` with a specified
  ``UNTIL`` but without an explicitly specified ``DTSTART``; the time zone
  of the generated ``DTSTART`` will now be taken from the ``UNTIL`` rule.
  Reported by href (gh issue 652). Fixed by absreim (gh pr 693).
- Fixed an issue where ``parser.parse`` would raise ``Decimal``-specific errors
  instead of a standard ``ValueError`` if certain malformed values were parsed
  (e.g. ``NaN`` or infinite values). Reported and fixed by
  amureki (gh issue 662, gh pr 679).
- Fixed issue in ``parser`` where a ``tzinfos`` call explicitly returning
  ``None`` would throw a ``ValueError``.
  Fixed by parsethis (gh issue 661, gh pr 681)
- Fixed incorrect parsing of certain dates earlier than 100 AD when repesented
  in the form &quot;%B.%Y.%d&quot;, e.g. &quot;December.0031.30&quot;. (gh issue 687, pr 700)
- Add support for ISO 8601 times with comma as the decimal separator in the
  ``dateutil.parser.isoparse`` function. (gh pr 721)
- Changed handling of ``T24:00`` to be compliant with the standard. ``T24:00``
  now represents midnight on the *following* day.
  Fixed by cheukting (gh issue 658, gh pr 751)
- Fixed an issue where ``isoparser.parse_isotime`` was unable to handle the
  ``24:00`` variant representation of midnight. (gh pr 773)
- Added support for more than 6 fractional digits in `isoparse`.
  Reported and fixed by jayschwa (gh issue 786, gh pr 787).
- Added &#39;z&#39; (lower case Z) as valid UTC time zone in isoparser.
  Reported by cjgibson (gh issue 820). Fixed by Cheukting (gh pr 822)
- Fixed a bug with base offset changes during DST in ``tzfile``, and refactored
  the way base offset changes are detected. Originally reported on
  StackOverflow by MartinThoma. (gh issue 812, gh pr 810)
- Fixed error condition in ``tz.gettz`` when a non-ASCII timezone is passed on
  Windows in Python 2.7. (gh issue 802, pr 861)
- Improved performance and inspection properties of ``tzname`` methods.
  (gh pr 811)
- Removed unnecessary binary_type compatibility shims.
  Added by jdufresne (gh pr 817)
- Changed ``python setup.py test`` to print an error to ``stderr`` and exit
  with 1 instead of 0. Reported and fixed by hroncok (gh pr 814)
- Added a ``pyproject.toml`` file with build requirements and an explicitly
  specified build backend. (gh issue 736, gh prs 746, 863)


Documentation changes
---------------------

- Added documentation for the ``rrule.rrulestr`` function.
  Fixed by prdickson (gh issue 623, gh pr 762)
- Added documentation for ``dateutil.tz.gettz``.
  Fixed by weatherpattern (gh issue 647, gh pr 704)
- Add documentation for the ``dateutil.tz.win`` module and mocked out certain
  Windows-specific modules so that autodoc can still be run on non-Windows
  systems. (gh issue 442, pr 715)
- Added changelog to documentation. (gh issue 692, gh pr 707)
- Changed order of keywords in the ``rrule`` docstring.
  Reported and fixed by rmahajan14 (gh issue 686, gh pr 695).
- Improved documentation on the use of ``until`` and ``count`` parameters in
  ``rrule``. Fixed by lucaferocino (gh pr 755).
- Added an example of how to use a custom ``parserinfo`` subclass to parse
  non-standard datetime formats in the examples documentation for ``parser``.
  Added by prdickson (gh 753)
- Added doctest examples to ``tzfile`` documentation.
  Patch by weatherpattern (gh pr 671)
- Updated the documentation for ``relativedelta``&#39;s ``weekday`` arguments.
  Fixed by kvn219 huangy22 and ElliotJH (gh pr 673)
- Improved explanation of the order that ``relativedelta`` components are
  applied in. Fixed by kvn219 huangy22 and ElliotJH (gh pr 673)
- Expanded the description and examples in the ``relativedelta`` class.
  Contributed by andrewcbennett (gh pr 759)
- Improved the contributing documentation to clarify where to put new changelog
  files. Contributed by andrewcbennett (gh pr 757)
- Fixed a broken doctest in the ``relativedelta`` module.
  Fixed by nherriot (gh pr 758).
- Changed the default theme to ``sphinx_rtd_theme``, and changed the sphinx
  configuration accordingly. (gh pr 707)
- Reorganized ``dateutil.tz`` documentation and fixed issue with the
  ``dateutil.tz`` docstring. (gh pr 714)
- Cleaned up malformed RST in the ``tz`` documentation.
  (gh issue 702, gh pr 706)
- Corrected link syntax and updated URL to https for ISO year week number
  notation in ``relativedelta`` examples. (gh issue 670, pr 711)


Misc
----

- GH 674, GH 688, GH 699, GH 720, GH 723, GH 726, GH 727, GH 740,
  GH 750, GH 760, GH 767, GH 772, GH 773, GH 780, GH 784, GH 785,
  GH 791, GH 799, GH 813, GH 836, GH 839, GH 857
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/python-dateutil
  - Changelog: https://pyup.io/changelogs/python-dateutil/
  - Docs: https://dateutil.readthedocs.io
</details>





### Update [s3transfer](https://pypi.org/project/s3transfer) from **0.1.13** to **0.2.0**.


<details>
  <summary>Changelog</summary>
  
  
   ### 0.2.0
   ```
   =====

* feature:``ProcessPoolDownloader``: Add ``ProcessPoolDownloader`` class to speed up download throughput by using processes instead of threads.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/s3transfer
  - Changelog: https://pyup.io/changelogs/s3transfer/
  - Repo: https://github.com/boto/s3transfer
</details>





### Update [setuptools](https://pypi.org/project/setuptools) from **40.7.3** to **40.8.0**.


<details>
  <summary>Changelog</summary>
  
  
   ### 40.8.0
   ```
   -------

* 1652: Added the ``build_meta:__legacy__`` backend, a &quot;compatibility mode&quot; PEP 517 backend that can be used as the default when ``build-backend`` is left unspecified in ``pyproject.toml``.
* 1635: Resource paths are passed to ``pkg_resources.resource_string`` and similar no longer accept paths that traverse parents, that begin with a leading ``/``. Violations of this expectation raise DeprecationWarnings and will become errors. Additionally, any paths that are absolute on Windows are strictly disallowed and will raise ValueErrors.
* 1536: ``setuptools`` will now automatically include licenses if ``setup.cfg`` contains a ``license_file`` attribute, unless this file is manually excluded inside ``MANIFEST.in``.
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/setuptools
  - Changelog: https://pyup.io/changelogs/setuptools/
  - Repo: https://github.com/pypa/setuptools
</details>





### Update [boto3](https://pypi.org/project/boto3) from **1.9.86** to **1.9.91**.


<details>
  <summary>Changelog</summary>
  
  
   ### 1.9.91
   ```
   ======

* api-change:``discovery``: [``botocore``] Update discovery client to latest version
* api-change:``ecs``: [``botocore``] Update ecs client to latest version
* api-change:``dlm``: [``botocore``] Update dlm client to latest version
   ```
   
  
  
   ### 1.9.90
   ```
   ======

* api-change:``es``: [``botocore``] Update es client to latest version
* api-change:``medialive``: [``botocore``] Update medialive client to latest version
* api-change:``gamelift``: [``botocore``] Update gamelift client to latest version
* api-change:``robomaker``: [``botocore``] Update robomaker client to latest version
   ```
   
  
  
   ### 1.9.89
   ```
   ======

* api-change:``ec2``: [``botocore``] Update ec2 client to latest version
* api-change:``fsx``: [``botocore``] Update fsx client to latest version
   ```
   
  
  
   ### 1.9.88
   ```
   ======

* api-change:``shield``: [``botocore``] Update shield client to latest version
* api-change:``servicecatalog``: [``botocore``] Update servicecatalog client to latest version
* api-change:``ec2``: [``botocore``] Update ec2 client to latest version
   ```
   
  
  
   ### 1.9.87
   ```
   ======

* api-change:``ecs``: [``botocore``] Update ecs client to latest version
* api-change:``application-autoscaling``: [``botocore``] Update application-autoscaling client to latest version
* api-change:``workspaces``: [``botocore``] Update workspaces client to latest version
* api-change:``codecommit``: [``botocore``] Update codecommit client to latest version
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/boto3
  - Changelog: https://pyup.io/changelogs/boto3/
  - Repo: https://github.com/boto/boto3
</details>





### Update [Django](https://pypi.org/project/Django) from **2.0.10** to **2.0.12**.


<details>
  <summary>Changelog</summary>
  
  
   ### 2.0.12
   ```
   ===========================

*February 11, 2019*

Django 2.0.12 fixes a packaging error in 2.0.11.

Bugfixes
========

* Corrected packaging error from 2.0.11 (:ticket:`30175`).


===========================
   ```
   
  
  
   ### 2.0.11
   ```
   ===========================

*February 11, 2019*

Django 2.0.11 fixes a security issue in 2.0.10.

CVE-2019-6975: Memory exhaustion in ``django.utils.numberformat.format()``
--------------------------------------------------------------------------

If ``django.utils.numberformat.format()`` -- used by ``contrib.admin`` as well
as the the ``floatformat``, ``filesizeformat``, and ``intcomma`` templates
filters -- received a ``Decimal`` with a large number of digits or a large
exponent, it could lead to significant memory usage due to a call to
``&#39;{:f}&#39;.format()``.

To avoid this, decimals with more than 200 digits are now formatted using
scientific notation.


===========================
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/django
  - Changelog: https://pyup.io/changelogs/django/
  - Homepage: https://www.djangoproject.com/
</details>





### Update [pytest-testrail](https://pypi.org/project/pytest-testrail) from **2.3.2** to **2.3.3**.


<details>
  <summary>Changelog</summary>
  
  
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest-testrail
  - Changelog: https://pyup.io/changelogs/pytest-testrail/
  - Repo: http://github.com/allankp/pytest-testrail/
</details>





### Update [pip](https://pypi.org/project/pip) from **19.0.1** to **19.0.2**.


<details>
  <summary>Changelog</summary>
  
  
   ### 19.0.2
   ```
   ===================

Bug Fixes
---------

- Fix a crash where PEP 517-based builds using ``--no-cache-dir`` would fail in
  some circumstances with an ``AssertionError`` due to not finalizing a build
  directory internally. (`6197 &lt;https://github.com/pypa/pip/issues/6197&gt;`_)
- Provide a better error message if attempting an editable install of a
  directory with a ``pyproject.toml`` but no ``setup.py``. (`6170 &lt;https://github.com/pypa/pip/issues/6170&gt;`_)
- The implicit default backend used for projects that provide a ``pyproject.toml``
  file without explicitly specifying ``build-backend`` now behaves more like direct
  execution of ``setup.py``, and hence should restore compatibility with projects
  that were unable to be installed with ``pip`` 19.0. This raised the minimum
  required version of ``setuptools`` for such builds to 40.8.0. (`6163 &lt;https://github.com/pypa/pip/issues/6163&gt;`_)
- Allow ``RECORD`` lines with more than three elements, and display a warning. (`6165 &lt;https://github.com/pypa/pip/issues/6165&gt;`_)
- ``AdjacentTempDirectory`` fails on unwritable directory instead of locking up the uninstall command. (`6169 &lt;https://github.com/pypa/pip/issues/6169&gt;`_)
- Make failed uninstalls roll back more reliably and better at avoiding naming conflicts. (`6194 &lt;https://github.com/pypa/pip/issues/6194&gt;`_)
- Ensure the correct wheel file is copied when building PEP 517 distribution is built. (`6196 &lt;https://github.com/pypa/pip/issues/6196&gt;`_)
- The Python 2 end of life warning now only shows on CPython, which is the
  implementation that has announced end of life plans. (`6207 &lt;https://github.com/pypa/pip/issues/6207&gt;`_)

Improved Documentation
----------------------

- Re-write README and documentation index (`5815 &lt;https://github.com/pypa/pip/issues/5815&gt;`_)
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pip
  - Changelog: https://pyup.io/changelogs/pip/
  - Homepage: https://pip.pypa.io/
</details>







Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: pyup-bot <github-bot@pyup.io>
@pegr69
Copy link

pegr69 commented Feb 25, 2019

Same for me a package with a dash was the culprit.

@fingoldo
Copy link

So when will this be fixed? Or what is the workaround?

@cjerdonek
Copy link
Member

The cause for a lot of these was fixed in version 19.0.2, which is why this issue was closed. However, people might still be experiencing this issue because of directories that were corrupted before (or getting corrupted for a completely different reason). Subscribe to issue #6283 for more graceful handling of these directories, and for suggestions on how to remove a corrupted directory you might have.

atipi referenced this issue in vilkasgroup/Pakettikauppa Mar 12, 2019



### Update [pip](https://pypi.org/project/pip) from **19.0.1** to **19.0.3**.


<details>
  <summary>Changelog</summary>
  
  
   ### 19.0.3
   ```
   ===================

Bug Fixes
---------

- Fix an ``IndexError`` crash when a legacy build of a wheel fails. (`6252 &lt;https://github.com/pypa/pip/issues/6252&gt;`_)
- Fix a regression introduced in 19.0.2 where the filename in a RECORD file
  of an installed file would not be updated when installing a wheel. (`6266 &lt;https://github.com/pypa/pip/issues/6266&gt;`_)
   ```
   
  
  
   ### 19.0.2
   ```
   ===================

Bug Fixes
---------

- Fix a crash where PEP 517-based builds using ``--no-cache-dir`` would fail in
  some circumstances with an ``AssertionError`` due to not finalizing a build
  directory internally. (`6197 &lt;https://github.com/pypa/pip/issues/6197&gt;`_)
- Provide a better error message if attempting an editable install of a
  directory with a ``pyproject.toml`` but no ``setup.py``. (`6170 &lt;https://github.com/pypa/pip/issues/6170&gt;`_)
- The implicit default backend used for projects that provide a ``pyproject.toml``
  file without explicitly specifying ``build-backend`` now behaves more like direct
  execution of ``setup.py``, and hence should restore compatibility with projects
  that were unable to be installed with ``pip`` 19.0. This raised the minimum
  required version of ``setuptools`` for such builds to 40.8.0. (`6163 &lt;https://github.com/pypa/pip/issues/6163&gt;`_)
- Allow ``RECORD`` lines with more than three elements, and display a warning. (`6165 &lt;https://github.com/pypa/pip/issues/6165&gt;`_)
- ``AdjacentTempDirectory`` fails on unwritable directory instead of locking up the uninstall command. (`6169 &lt;https://github.com/pypa/pip/issues/6169&gt;`_)
- Make failed uninstalls roll back more reliably and better at avoiding naming conflicts. (`6194 &lt;https://github.com/pypa/pip/issues/6194&gt;`_)
- Ensure the correct wheel file is copied when building PEP 517 distribution is built. (`6196 &lt;https://github.com/pypa/pip/issues/6196&gt;`_)
- The Python 2 end of life warning now only shows on CPython, which is the
  implementation that has announced end of life plans. (`6207 &lt;https://github.com/pypa/pip/issues/6207&gt;`_)

Improved Documentation
----------------------

- Re-write README and documentation index (`5815 &lt;https://github.com/pypa/pip/issues/5815&gt;`_)
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pip
  - Changelog: https://pyup.io/changelogs/pip/
  - Homepage: https://pip.pypa.io/
</details>





### Update [wheel](https://pypi.org/project/wheel) from **0.32.3** to **0.33.1**.


<details>
  <summary>Changelog</summary>
  
  
   ### 0.33.1
   ```
   - Fixed the ``--build-number`` option for ``wheel pack`` not being applied
   ```
   
  
  
   ### 0.33.0
   ```
   - Added the ``--build-number`` option to the ``wheel pack`` command
- Fixed bad shebangs sneaking into wheels
- Fixed documentation issue with ``wheel pack`` erroneously being called
  ``wheel repack``
- Fixed filenames with &quot;bad&quot; characters (like commas) not being quoted in
  ``RECORD`` (PR by Paul Moore)
- Sort requirements extras to ensure deterministic builds
  (PR by PoncinMatthieu)
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/wheel
  - Changelog: https://pyup.io/changelogs/wheel/
  - Repo: https://github.com/pypa/wheel
</details>





### Update [PyYAML](https://pypi.org/project/PyYAML) from **4.2b4** to **5.1b3**.


*The bot wasn't able to find a changelog for this release. [Got an idea?](https://github.com/pyupio/changelogs/issues/new)*

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pyyaml
  - Homepage: http://pyyaml.org/wiki/PyYAML
</details>
@gosuto-inzasheru
Copy link

Fixed by removing a folder called -umpy-1.15.4.dist-info from site-packages.

@ratav
Copy link

ratav commented Mar 16, 2019

Hi guys,
I just would like to point out that I also fixed this problem after removing a folder called -andas-0.23.0.dist-info from site-packages

It seems that something went wrong during the installation/update of pandas package and this folder -andas-0.23.0.dist-info is a leftover after a pip auto troubleshooter.

Thanks all for the contribution 👍

@zooba
Copy link
Contributor

zooba commented Mar 18, 2019

@cjerdonek FYI I'm unsubscribing from the "me too" comments. If you need me back here, you'll have to ping me.

@qwitwa
Copy link

qwitwa commented Mar 19, 2019

To identify offending packages, I ran the following inside the site-packages directory:

import os
import re
for roots, dirs, files in os.walk("."):
    if re.match(".*dist-info", roots):
        if "METADATA" not in files:
            print(roots)

Then removed the offending directories and reinstalled their packages.

pganssle pushed a commit to cjerdonek/setuptools that referenced this issue Mar 31, 2019
pganssle pushed a commit to cjerdonek/setuptools that referenced this issue Mar 31, 2019
Related to pip's github issue pypa/pip#6194.

This has come up in pip's issue tracker (github) multiple times:

  - pypa/pip#6177
  - pypa/pip#6283
  - pypa/pip#6194
pganssle pushed a commit to cjerdonek/setuptools that referenced this issue Apr 3, 2019
Related to pip's github issue pypa/pip#6194.

This has come up in pip's issue tracker (github) multiple times:

  - pypa/pip#6177
  - pypa/pip#6283
  - pypa/pip#6194
@cjerdonek
Copy link
Member

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: pypa/setuptools#1706 (comment)

@DawnEve
Copy link

DawnEve commented May 14, 2019

I realized that broken packages may exist in /Users/king/Library/Python/3.6/lib/python/site-packages and it does in fact. After i remove broken packages in this folder, pip comes back to life!

1.I remove all files here,

$ pwd
/home/wangjl/.local/lib/python3.7/site-packages
$ rm -Rf ./*

2.and reinstall pip again,
$ cd ~/software/
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python ./get-pip.py --user

3.then all is fine.
$ pip -V
pip 19.1.1 from /home/wangjl/.local/lib/python3.7/site-packages/pip (python 3.7)

$ pip list |head
Package Version


alabaster 0.7.11
anaconda-client 1.7.2
anaconda-navigator 1.9.2

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 13, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.