Sunday, April 28, 2024
-1
rated 0 times [  -1] [ 0]  / answers: 1 / hits: 9672  / 2 Years ago, tue, august 23, 2022, 6:19:27

I'm new to Ubuntu (20.04.2.0 LTS) and trying to get Python3.9.6 and Pip to work with Virtualenv.


I hope some of you experienced Ubuntu users can help me :)


I have no problem using default Python (3.8.10):


$ python3 -V Python 3.8.10

$ whereis python3
/usr/bin/python3.8

$ pip3 -V
pip 21.1.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

$ virtualenv env_python3.8
created virtual environment CPython3.8.10.final.0-64 in 155ms

$ source env_python3.8/bin/activate

(env_python3.8) usagi@dev:~$ pip list
Package Version
pip 20.0.2 pkg-resources 0.0.0
setuptools 44.0.0 wheel 0.34.2

(env_python3.8) usagi@dev:~$ pip install django
Successfully installed asgiref-3.4.1 django-3.2.5 pytz-2021.1 sqlparse-0.4.1

(env_python3.8) usagi@dev:~$ pip list
Package Version
asgiref 3.4.1
Django 3.2.5
pip 20.0.2 pkg-resources 0.0.0
pytz 2021.1 setuptools 44.0.0 sqlparse 0.4.1
wheel 0.34.2

These steps work without any problems, but if I do the same steps for Python3.9.6 (from source), it will not work:


$ python3.9 -V 
Python 3.9.6

$ whereis python3
/usr/local/bin/python3.9

Guess this is one the problems, pip3 looking at Python3.8
$ pip3 -V
pip 21.1.3 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)

$ virtualenv -p /usr/local/bin/python3.9 env_python3.9
created virtual environment CPython3.9.6.final.0-64 in 113ms

$ source env_python3.9/bin/activate

(env_python3.9) usagi@dev:~$ python -V
Python 3.9.6

(env_python3.9) usagi@dev:~$ pip -V
Traceback (most recent call last): File "/home/usagi
/env_python3.9/bin/pip", line 5, in from pip._internal.cli.main import main File "/home
/usagi/env_python3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 10, in
from pip._internal.cli.autocompletion import autocomplete File "/home/usagi/env_python3.9
/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 9, in from
pip._internal.cli.main_parser import create_main_parser File "/home/usagi/env_python3.9
/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 7, in from
pip._internal.cli import cmdoptions File "/home/usagi/env_python3.9/lib/python3.9/site-
packages/pip/_internal/cli/cmdoptions.py", line 24, in from pip._internal.exceptions
import CommandError File "/home/usagi/env_python3.9/lib/python3.9/site-packages
/pip/_internal/exceptions.py", line 10, in from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'

Tried to find information about the error but could not find a solution.


If any of you have had the same problem or recognize the problem and would like to help me, I am grateful for all the help I can get.


Best regards, /Mikael


More From » software-installation

 Answers
6

I can't tell you why your compiled version is not working. Using the Ubuntu repo, you can get what you want and will get updated with the rest of the system:


sudo apt install python3.9 python3.9-venv

this will give you pip3.9 and the ability to create a virtual environment, something like this:


python3.9 -m venv $HOME/.venv/python3.9

[#1358] Wednesday, August 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
itagde

Total Points: 241
Total Questions: 113
Total Answers: 118

Location: Liechtenstein
Member since Wed, Dec 8, 2021
2 Years ago
itagde questions
;