I am running on VirtualBox Ubuntu 18.04.5 LTS
. I am running Python 3.6.9
.
When trying to create a virtual environment with sudo python3 -m venv env
I get:
admin@admin-VirtualBox:~/Desktop/project$ sudo python3 -m venv .venv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/admin/Desktop/project/.venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
admin@admin-VirtualBox:~/Desktop/project$ python3 --version
Python 3.6.9
admin@admin-VirtualBox:~/Desktop/project$ sudo apt-get install python3.6-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3.6-venv : Depends: python3.6 (= 3.6.5-3) but 3.6.9-1~18.04ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.
admin@admin-VirtualBox:~/Desktop/project$
I researched and found that python3
has venv
already preinstalled. I believe there are some broken dependencies.
I tried:
admin@admin-VirtualBox:~/Desktop/project$ sudo apt-cache policy python3.6-venv python3.6 python3
python3.6-venv:
Installed: (none)
Candidate: 3.6.5-3
Version table:
3.6.5-3 500
500 http://at.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
python3.6:
Installed: 3.6.9-1~18.04ubuntu1.1
Candidate: 3.6.9-1~18.04ubuntu1.1
Version table:
*** 3.6.9-1~18.04ubuntu1.1 100
100 /var/lib/dpkg/status
3.6.5-3 500
500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
python3:
Installed: 3.6.7-1~18.04
Candidate: 3.6.7-1~18.04
Version table:
*** 3.6.7-1~18.04 100
100 /var/lib/dpkg/status
3.6.5-3 500
500 http://at.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Any suggestions how to fix this? What is the problem?
I appreciate your replies!