Python Forum

Full Version: pip doesn't work after Python upgrade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

After upgrading Python 3.6 to Python 3.10, pip became broken:

Output:
pavel@ALABAMA:~$ pip3 --version Traceback (most recent call last): File "/home/pavel/.local/bin/pip3", line 5, 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> collections.MutableMapping.register(ParseResults) AttributeError: module 'collections' has no attribute 'MutableMapping' pavel@ALABAMA:~$
Any suggestions ?
Thanks.
try

python3 -m pip install --upgrade pip
(May-28-2022, 03:22 PM)Axel_Erfurt Wrote: [ -> ]try

python3 -m pip install --upgrade pip

"C:\Python-3.10.2\python.exe: No module named pip"
(May-28-2022, 03:22 PM)Axel_Erfurt Wrote: [ -> ]try
python3 -m pip install --upgrade pip
I found where the problem is, but I don't know how to fix it.
The problem comes from the fact that I installed python 3.10 keeping the old 3.6.9.
It seems that gnome-terminal (my PC is running Ubuntu 18.04 LTS) is not compatible with python 3.10 because if I point python3 to 3.6.9 everything works.
So this reveals that I can't use gnome-terminal when python3 points to 3.10.
Any suggestions?
Never change the system python. Just install a new version alongside and either run a virtual environment or put it first in your PATH.
Quote:Never change the system python.
What do you mean by "system python" ?
I've just upgraded python (keeping old version) as I did it before.
The both 3.6.9 and 3.10 are python3, isn't it ?
The 1st line in gnome-terminal is: #!/usr/bin/python3.
So there is no distcinction between 3.6.9 and 3.10 given that the both are python3.

Quote:Just install a new version alongside
It's installed alongside: I can point python3 either to 3.6.9 either to 3.10.
When python3 points to 3.10, I can't use gnome-terminal which I got used to.

Quote:... put it first in your PATH
Can you elaborate, please.
Is python3.10 in /usr/local/bin? I am on Ubuntu and that's where it is located on my box.
Will typing /usr/local/bin/python3.10 in a terminal start the version or just typing python3.10
(May-30-2022, 07:50 AM)menator01 Wrote: [ -> ]Is python3.10 in /usr/local/bin? I am on Ubuntu and that's where it is located on my box.
Will typing /usr/local/bin/python3.10 in a terminal start the version or just typing python3.10
On my PC both are in /usr/bin.
What is the output in terminal

python3 --version


if you have multiple versions you could start your script with the specific version

python3 script.py

uses the default version

/path/to/python3.10 script.py

to use python3.10
(May-30-2022, 11:41 AM)Axel_Erfurt Wrote: [ -> ]What is the output in terminal

python3 --version


if you have multiple versions you could start your script with the specific version

python3 script.py

uses the default version

/path/to/python3.10 script.py

to use python3.10

Output:
pavel@ALABAMA:~$ python3 --version Python 3.6.9
It's because I switched to 3.6.9.
When I switch to 3.10, gnome-terminal stops working.
So the question is: does exist some technique, allowing to have at the same time (1) python3 pointed to 3.10 and (2) working gnome-terminal ?
Pages: 1 2