I recently installed python3.10 on my ubuntu system and I believe I made a link from /usr/bin/python3
to /usr/bin/python3.10
If I run python --version
I get Python 2.7.17
and if I run python3 --version
I get Python 3.10.2
I believe something I did broke something in my global python / pip.
Whenever I try to use pip globally I get this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 73, in <module>
vendored("pkg_resources")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 77, in <module>
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/extern/__init__.py", line 43, in load_module
File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'
After googling I thought the issue is that my pip was made using an older version of python I had so I tried to run:
sudo apt remove python-pip python3-pip
sudo apt install python-pip python3-pip
but even after this I still get the same error with pip.
I do have a virtualenv that I was using with a django project (that uses python 3.10) and if I source into that I am able to use the pip there, but I think this just shows the pip in that venv is properly configured
Result of running ls -la /usr/bin/ | grep -i
:
brick@nextgearserver:/etc/apache2$ ls -la /usr/bin/ | grep -i "pip\|python"
lrwxrwxrwx 1 root root 26 Mar 26 2018 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x 1 root root 1056 Apr 16 2018 dh_python2
lrwxrwxrwx 1 root root 29 Mar 26 2018 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx 1 root root 13 Dec 7 2018 lesspipe -> /bin/lesspipe
lrwxrwxrwx 1 root root 23 Feb 27 2021 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root 24 Jan 15 13:03 pdb3.10 -> ../lib/python3.10/pdb.py
lrwxrwxrwx 1 root root 23 Dec 8 16:08 pdb3.6 -> ../lib/python3.6/pdb.py
-rwxr-xr-x 1 root root 292 Apr 30 2021 pip
-rwxr-xr-x 1 root root 292 Apr 30 2021 pip2
-rwxr-xr-x 1 root root 293 Apr 30 2021 pip3
lrwxrwxrwx 1 root root 31 Oct 25 2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx 1 root root 26 Mar 26 2018 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx 1 root root 9 Apr 16 2018 python -> python2.7
lrwxrwxrwx 1 root root 9 Apr 16 2018 python2 -> python2.7
-rwxr-xr-x 1 root root 3633000 Feb 27 2021 python2.7
lrwxrwxrwx 1 root root 33 Feb 27 2021 python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root 16 Apr 16 2018 python2-config -> python2.7-config
lrwxrwxrwx 1 root root 19 Jan 30 15:07 python3 -> /usr/bin/python3.10
-rwxr-xr-x 1 root root 5515256 Jan 15 13:03 python3.10
-rwxr-xr-x 2 root root 4526456 Dec 8 16:08 python3.6
lrwxrwxrwx 1 root root 33 Dec 8 16:08 python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x 2 root root 4526456 Dec 8 16:08 python3.6m
lrwxrwxrwx 1 root root 34 Dec 8 16:08 python3.6m-config -> x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx 1 root root 16 Oct 25 2018 python3-config -> python3.6-config
-rwxr-xr-x 1 root root 384 Feb 5 2018 python3-futurize
lrwxrwxrwx 1 root root 10 Oct 25 2018 python3m -> python3.6m
lrwxrwxrwx 1 root root 17 Oct 25 2018 python3m-config -> python3.6m-config
-rwxr-xr-x 1 root root 388 Feb 5 2018 python3-pasteurize
-rwxr-xr-x 1 root root 152 Nov 11 2017 python3-pbr
lrwxrwxrwx 1 root root 16 Apr 16 2018 python-config -> python2.7-config
lrwxrwxrwx 1 root root 29 Apr 16 2018 pyversions -> ../share/python/pyversions.py
-rwxr-xr-x 1 root root 2971 Feb 27 2021 x86_64-linux-gnu-python2.7-config
-rwxr-xr-x 1 root root 3246 Jan 15 13:03 x86_64-linux-gnu-python3.10-config
lrwxrwxrwx 1 root root 34 Dec 8 16:08 x86_64-linux-gnu-python3.6-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x 1 root root 3283 Dec 8 16:08 x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx 1 root root 33 Oct 25 2018 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.6-config
lrwxrwxrwx 1 root root 34 Oct 25 2018 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx 1 root root 33 Apr 16 2018 x86_64-linux-gnu-python-config -> x86_64-linux-gnu
python2.7-config