how to create a virtual env with snap installed python38

Viewed 258

Using snap I installed python38 on an Ubuntu 18 server. now I want to create a new virtual environment but I fail as these commands fail:

virtualenv --python /snap/bin/python38 myvenv
Running virtualenv with interpreter /snap/bin/python38
python3.8: can't open file '/usr/lib/python3/dist-packages/virtualenv.py': [Errno 2] No such file or directory

test -f /usr/lib/python3/dist-packages/virtualenv.py; echo "it exists!"
# OUTPUT: it exists!

# --------------------------------------------------------------------------------

python38 -m venv myvenv
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: ['/tmp/myvenv/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

This is my first experience with snap, and I'm unsure how I can install python3-venv to make it work.

Any help would be appreciated

0 Answers
Related