user1592380
user1592380

Reputation: 36367

How to create virtualenv with python 3.6 venv

enter image description here

I'm trying to create a python virtualenv using anaconda python3.6 in ubuntu 16.04. Following https://docs.python.org/3/library/venv.html , I've tried

deploy@server:~/miniconda3/bin$ python3 -m venv ~/test
Error: Command '['/home/deploy/test/bin/python3', '-Im', 'ensurepip',    '--upgrade', '--default-pip']' returned non-zero exit status 1.

operating from the miniconda directory at ~/miniconda3/bin (screenshot). How can I this working?

edit:

deploy@server:~/miniconda3/bin$ /home/deploy/test/bin/python3 -Im ensurepip --upgrade --default-pip
/home/deploy/test/bin/python3: No module named ensurepip

Upvotes: 2

Views: 3884

Answers (1)

msitt
msitt

Reputation: 1237

If you are using anaconda, you should be using conda environments.

conda create --name test

For more information, see Managing Environments.


EDIT In response to OP wanting to use virtualenvs.

The error is with python not being able to find pip. You can get around this by installing it manually.

python3 -m venv test --without-pip
cd test
source bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3

At this point you will have a basic virtualenv with pip installed.

Upvotes: 3

Related Questions