I've recently install python 3.10 in my ubuntu 20.04. My steps for installation were:
apt install python3.10
apt install python3.10-dev
apt install python3.10-distutilsProblem is about the pip. It crashes when I try to install anything with error:
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)I have python versions 3.6 - 3.9 installed on my system. This problem only occurs with python version 3.10. What's the cause of this problem and solution?
3 Answers
I solved exactly the same symptoms by entering pipenv shell and installing pip there:
pipenv shell
curl -sS | pythonThis resulted in:
Collecting pip Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 20.0.2 Uninstalling pip-20.0.2: Successfully uninstalled pip-20.0.2
Successfully installed pip-21.3.1After that things started to work as expected and pipenv install was successful. Countless other ways of installing and reinstalling python/pip/pipenv failed, many times with the same import error.
The following commands solved my pip and sudo pip problems:
curl -sS | python 3.10curl -sS | sudo python 3.10 You should better use pyenv and/or virtualenv. Some libs are not compatible with different python versions. Also pip does not know for what python version you want to install the requested lib.
Here are some tutorials or go and search in youtube.
2