Package 'python3-venv' has no installation candidate

Question:

I’m currently trying to install Flask for testing a simple web page.
Unfortunately i got the following message:

Command 'virtualenv' not found, but can be installed with:
sudo apt install python3-virtualenv

When i do it, i got :

Unable to locate package python3-virtualenv

I check my python version and I’m on Python 3.10.4

Whent i try sudo apt-get update i got:

W: Some index files failed to download. They have been ignored, or old ones used instead.

Whent i try sudo apt-get upgrade i got:

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

And when i try sudo apt-get install python3-venv i got :

E: Package 'python3-venv' has no installation candidate
Asked By: myUsserName

||

Answers:

sudo apt install python3-virtualenv works perfectly fine with me.
Alternatively you can install it using pip

pip3 install virtualenv

After completion you can check for which virtualenv to get the path of the location where it has been installed.

It seems there is an error with your ubuntu, You can use this site and fix it and then install the virtual environment : https://www.tecmint.com/some-index-files-failed-to-download.

Answered By: AKM

Had this problem after upgrading to Ubuntu 20.4 and all my problems stemmed from a very old version of Pip that was solved by this lovely command:

curl -sS https://bootstrap.pypa.io/get-pip.py | python3

More information and some alternatives here: pip3 install not working – No module named 'pip._vendor.pkg_resources'

Answered By: InnocentBystander
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.