When trying to start a virtual environment I get:
~$ python3 -m venv homeassistant
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.
Failing command: ['/home/gal/homeassistant/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']But when I try to install python3-venv I get:
~$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.I should have several python versions installed but I remove them as alternatives:
~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.7
Nothing to
Nothing to configure.Python version is 3.7.5:
~$ python3 --version
Python 3.7.5OS version is:
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionicI think that the problem is becuase of 'python3-venv is already the newest version (3.6.7-1~18.04).' while the version I use is 3.7 and not 3.6. But I don't know how to proceed.
Thanks for any suggestions.
11 Answer
You can install a venv for your version of python.
sudo apt-get install python3.7-venv