0

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 configure.usr/bin/python3.7
Nothing to configure.

Python version is 3.7.5:

~$ python3 --version
Python 3.7.5

OS version is:

~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

I 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.

1
  • Your analysis is correct: 3.6's venv won't work with 3.7. You can either look for a 3.7 version in either apt or pip, or you can change to Py3.6.
    – user535733
    May 14, 2020 at 21:06

1 Answer 1

1

You can install a venv for your version of python.

sudo apt-get install python3.7-venv

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.