'how to install virtualenv on Ubuntu 20.04 GCP instance?
I am trying to install python3 virtualenv. I get the following message when I try to run virtualenv.
virtualenv
Command 'virtualenv' not found, but can be installed with:
apt install python3-virtualenv
but if I run install command, I get the following error.
apt install python3-virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-virtualenv
For python3 -m venv, I get message to install using apt-get install python3-venv
but when I try it, I get the same message.
sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-venv' has no installation candidate
I am running this as root. wget also works.
Solution 1:[1]
try type in terminal:
sudo apt-get install python3.8-venv
and then try again install virtualenv
Solution 2:[2]
The below is very similar to the answer by phd, but my freshly installed Ubuntu 20.04 still requires the python version number:
apt-get update
apt-get install python3-virtualenv
Solution 3:[3]
This will definitely work:
sudo apt-get update
sudo apt-get install python3-virtualenv
Solution 4:[4]
I was getting the error E: Unable to locate package python3-virtualenv
because I had to run apt-get update first. This was my brand new GCP instance.
Reference: first comment of the first answer in this thread. Unable to locate package virtualenv in ubuntu-13 on a virtual-machine
Thank you all.
Solution 5:[5]
sudo apt install python3-virtualenv
Solution 6:[6]
First get the updated information and then install the virtual environment with below two command simultaneously.
sudo apt update
sudo apt install python3-virtualenv
Solution 7:[7]
I also got that problem and was able to solve it by follow means:
software-properties-gtk
After clicking enter a window pops up. Then you have to check the first 4 boxes, close it and refresh it. After that the problem should be solved and you're ready to go
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | artix97 |
| Solution 2 | dr.Pep |
| Solution 3 | Mahesh Jamdade |
| Solution 4 | RedFox |
| Solution 5 | dKen |
| Solution 6 | Tanvir Nayem |
| Solution 7 | Andrew Schöller |
