pyvenv not working because ensurepip is not available

Solution 1:

try installing python3.6-venv:

sudo apt-get install python3.6-venv

Solution 2:

It seems that it was a locale problem. Solved by executing:

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

found on this thread Python locale error: unsupported locale setting

Solution 3:

One of the other answers fixed it for me last time, but with Python 3.7 I had to do:

apt install python3-pip python3-setuptools python3.7-venv

Followed by

python3.7 -m venv /path/to/venv

Solution 4:

Under Windows Linux Subsystem and Ubuntu 18.04, this was caused by my not having upgraded recently.

I ran:

sudo apt update
sudo apt upgrade

Then sudo apt install python3-venv worked.

Note that I had also tried the UTF-8 solution beforehand (I made it part of my .bashrc), so that could have been a contributing factor.