Forums

Error creating virtualenv

I tried to create a virtualenv for a django app. That is the result:

21:27 ~ $ source virtualenvwrapper.sh                                                                                                                                           
21:29 ~ $ mkvirtualenv --python=python3.4 django16
Running virtualenv with interpreter /usr/bin/python3.4
Using base prefix '/usr'
New python executable in django16/bin/python3.4
Also creating executable in django16/bin/python
Failed to import the site module
Traceback (most recent call last):
  File "/home/gestionebeb/.virtualenvs/django16/lib/python3.4/site.py", line 67, in <module>
    import os
  File "/home/gestionebeb/.virtualenvs/django16/lib/python3.4/os.py", line 614, in <module>
    from _collections_abc import MutableMapping
ImportError: No module named '_collections_abc'
ERROR: The executable django16/bin/python3.4 is not functioning
ERROR: It thinks sys.prefix is '/home/gestionebeb/.virtualenvs' (should be '/home/gestionebeb/.virtualenvs/django16')
ERROR: virtualenv is not compatible with this system or executable
21:30 ~ $ workon django16
ERROR: Environment '/home/gestionebeb/.virtualenvs/django16' does not contain an activate script.
21:30 ~ $

Thanks for help

[edited by admin: formatting]

Hi there -- sorry about that, it looks like we have a bug in our virtualenv support for Python 3.4. Do you think you could use Python 3.3 until this is fixed?

Parts of the program use new python 3.4 features but I think it is not so difficult modifying them. I'll check it out

Parts of the program use new python 3.4 features but I think it is not so difficult modifying them. I'll check it out

OK, thanks. Let me know if you have any problems.

virtualenv is not compatible with Python 3.4. Python 3.4 has the same functionality built in:

python3.4 -m venv env_name

will create a virtualenv in the directory env_name.

There is a little weirdness at the moment: pip for the virtualenv gets installed to env_name/local/bin and that's not on the PATH for the virtualenv, so you need to use the full path to pip to run it.

Some further experimentation:

python3.4 -m venv env_name --without-pip
source env_name/bin/activate
python3.4 -m ensurepip

produces a virtualenv with pip in the right place.

Same issue, hope it gets fixed soon!