after updating everything in conda, pip can't install anything
conda update -n base conda
conda update --all
when install or upgrade anything, this error is show
$ pip install --upgrade HDF5
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\pip-script.py", line 10, in <module>
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\commands\install.py", line 23, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\req_command.py", line 17, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder'
any help please. thank you.
The Python "ImportError: cannot import name" occurs when we have circular imports (importing members between the same files). To solve the error, move the objects to a third file and import them from a central location in other files, or nest one of the imports in a function.
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
It seems that this works. Reinstall the latest version of pip:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py
When you’re done, delete the installation script:
$ rm get-pip.py
Solved this by manually updating: Command Line Tools for XCode.
From the terminal run:
softwareupdate --list
which produces a list of available updates.
Wait a bit for a list to display (won't take very long). And look for the "* Label:" under Software Update found the following new or updated software:
It should say something like: * Label: Command Line Tools for Xcode-13.0
Then simply run: softwareupdate -i "Command Line Tools for Xcode-13.0"
and replace the text in the brackets with the Label from the previous output. This will then install the updates and the fix for python3.
Then run: pip3 --version
and it should work.
This happens usually, if you try to reinstall pip and the distro's pre-packaged version mismatches the previously installed version (e.g. 19.0.3 (packaged)
vs 20.0.2 (installed)
at time of writing).
Removing the /path/to/site-packages/pip*
directories is a simple (yet safe) solution.
Here's a little bash script for the system installed version (thus requires sudo):
#!/bin/bash
set -e
# Set PY_MAJ and PY_MIN with your own python "major.minor" version
# Example for python 3.8
# PY_MAJ='3'
# PY_MIN='8'
cd /usr/lib/python${PY_MAJ}.${PY_MIN}/site-packages/ \
&& rm -rf pip/ \
&& rm -rf pip-*/ \
; cd -
Note for virtual environments: Basically the same is valid for venv's. Only difference is the "site-packages" directory location.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With