On Ubuntu 20.04 i have installed pip3 with the following command:sudo apt install python3-pip
But when I run pip3 I get the following error:
Traceback (most recent call last): File "/usr/bin/pip3", line 6, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python3.8/dist-packages/pkg_resources.py", line 1479, in <module> register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'In a virtual-environment the pip3 command works fine however.
As suggested in other answers I have tried reinstalling python3 and pip3, all without success. A lot of other answers use pip3 to solve the problem, but I'm unable to run pip3.
I have noticed that several other programs (docker-compose, Guake) give me a similar error.
I run python 3.8.2. And when I open an virtual-environment I can see that my pip3 version is 20.0.2.
12 Answers
I recently experienced this with Ubuntu 20.04 LTS as well. After lengthy troubleshooting, I was able to resolve this by running:
python3 -m pip install --upgrade setuptools 1 I received this error as well, the only thing that worked was the following after troubleshooting and seeing python3 installed at 3.8.2 but pip or pip3 command not found:
sudo apt install python3-pip
After this, everything worked fine. It looks like it installs python dev related packages including pip that was missing.
Note: This was for Ubuntu 20.04 specifically to get python and pip commands working properly.