Skip to content Skip to sidebar Skip to footer

Importerror: Cannot Import Name 'packagefinder'

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

Solution 1:

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

Solution 2:

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/bashset -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.

Solution 3:

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.

Solution 4:

I had a similar error installing python3 (3.6.9) and pip3 on Alpine 3.7.

In my case the answer was follow the python install/upgrade with:

python3 -m ensurepip --upgrade

The --upgrade option will cause it to uninstall any old versions and install a version compatible with the python version

Solution 5:

ok i find que solution and it's fix my problem https://github.com/pypa/pip/issues/7620#issuecomment-576655739

A workaround to get pip working again is getting the get-pip.py script and running: python get-pip.py pip==19.3.1 This will revert pip to the previous version

Post a Comment for "Importerror: Cannot Import Name 'packagefinder'"