pip3 is unable to create virtual environment on Ubuntu 20.04 LTS on Windows 10 because ensurepip is not available

I was working with virtual environments with Ubuntu 18.04 LTS but I uninstalled it and installed Ubuntu 20.04 LTS on windows 10, but now when I create venv then error is

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.

when I install sudo apt-get install python3-venv it say installed but still struggling badly

Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

3 Answers

I'd suggest to add the deadsnake-ppa and install

sudo apt install python3.8-venv

Stumbled on this while having the same problem.

The answer by @alexandre-b solved it for me. Wanted to post here because of this questions search ranking.

basically:

python3.* -m venv myvenv

where * is your specific python version.

You can check your python version with

python3 --version

Use:

  1. virtualenv my1 instead of python3 -m venv my1.

  2. cd my1

  3. source bin/activate

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like