-2

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
davidism
  • 121,510
  • 29
  • 395
  • 339
myUsserName
  • 41
  • 1
  • 5
  • Newer Python versions come with venv. Just try `python3 -m venv ...`. – Klaus D. Sep 07 '22 at 08:37
  • I got the following "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", but my problem is that i can't install python3 environment – myUsserName Sep 07 '22 at 08:42
  • 1
    You should try to fix the package manager issues first. But that's not a topic for Stack Overflow. – Klaus D. Sep 07 '22 at 08:56

2 Answers2

1

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.

AKM
  • 34
  • 6
0

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'