9

I'm working on Linux Mint 17 and I'm trying to create a new virtualenv with Python3 like this:

python3.6 -m venv env

And this is the error that I get:

Error: Command '['/home/ric/myprojs/django-example-channels/env/bin/python3.6', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

I've googled this error message but haven't managed to find anything too informative.

This is my pip version, in case it make any difference:

pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

I've been using Python2 for some time, but I'm new to Python3. I don't know what I may be missing.

UPDATE 1:

Answering @cezar's question, when I type  which python3 this is what I get:

$ which python3
/usr/bin/python3

UPDATE 2:

Answering @Chłop Z Lasu:

$ virtualenv -p python3.6 env
Running virtualenv with interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /home/ric/myprojs/django-example-channels/example_channels/env/bin/python3.6
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 2328, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 925, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1231, in install_python
    shutil.copyfile(executable, py_executable)
  File "/usr/lib/python3.6/shutil.py", line 104, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
5
  • 1
    You run python3.6 from your virtual environment. In Linux Mint 17 python3 is installed per default and should be available under /usr/bin/python3. What happens if you do which python3? Commented Jun 9, 2017 at 11:10
  • 1
    Your question is about the python standard library module venv (docs.python.org/3/library/venv.html). That is not the same as virtualenv (pypi.python.org/pypi/virtualenv). Maybe you should edit the tags to reflect this. Commented Jun 9, 2017 at 11:13
  • I just edited my question @cezar Commented Jun 9, 2017 at 11:14
  • 1
    Possible duplicate of Using Python 3 in virtualenv Commented Jun 9, 2017 at 11:45
  • 2
    By the way, pip3 --version is what you should check, notice that output is Python2 Commented Jun 12, 2017 at 16:11

3 Answers 3

21

The error indicates that virtualenv is trying to make an environment in your python path. therefore, you have to specify your virtualenv destination

virtualenv -p python3.6 /path/to/yourenv
Sign up to request clarification or add additional context in comments.

Comments

4

For venv and python3.6 installing venv one can use below to fix the issue

sudo apt install python3.6-venv

Comments

-2

You gotta install the venv via code bellow:

sudo apt install python3.6-venv

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.