Python-3-only virtualenvwrapper

Skip to first unread message

Lumír Balhar

Mar 19, 2018, 9:26:00 AM3/19/18
to virtualenvwrapper

I recently met a bug when trying to use virtualenvwrapper in Python-3-only environment. From `` it's obvious that it depends on Python 2 and you have to define `VIRTUALENVWRAPPER_PYTHON` environment variable to use other Python but even then it won't work because there is also a dependency on `virtualenv` command which is provided by Python 2 virtualenv package.

I am using Fedora and of course, we can do some hacks to support Python 3 only environments based on Fedora, but I would prefer to adress this need in upstream. As published last week, Python 2 EOL will be 1/1/2020 and I'd like my favorite tool to be ready for Python 3.

I can imagine two new scripts `` and  `` which would both source `` but with some variables setting in advance which will make wrapper to point to right binaries.

 What do you think about it? I can try to implement my idea and prepare pull request.

Have a nice day.

Jason Myers

Mar 19, 2018, 10:15:42 AM3/19/18
Virtualenv is a python package that you have to install and it does support Python 3. I'm using both it and virtualenvwrapper on python3 every day on Pop_Os and Mac OS X. Can you share the exact error you are running into and let's see if we can help resolve your issue?


You received this message because you are subscribed to the Google Groups "virtualenvwrapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Message has been deleted
Message has been deleted
Message has been deleted

Gary Oberbrunner

Jan 24, 2019, 9:57:38 PM1/24/19
to virtualenvwrapper
I suspect part of Lumir's problem is that python3.7 no longer provides the `virtualenv` command; users are supposed to use python3 -mvenv instead. (Similarly to how "pip" is being phased out in favor of "python -mpip".) See issue #320.
To unsubscribe from this group and stop receiving emails from it, send an email to

Lumír Balhar

Jan 29, 2019, 5:45:23 AM1/29/19
to virtualenvwrapper
I did a test again on Fedora rawhide which comes with only Python 3.

$ pip3 --version
18.0 from /usr/lib/python3.7/site-packages/pip (python 3.7)

$ pip3 install
--user virtualenvwrapper

export WORKON_HOME=$HOME/.virtualenvs

$ source
: no python in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)
: : command not found
.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed
= and that PATH is
set properly

As you can see in PEP 394 (, /usr/bin/python still has to be a symlink pointing to python2 so when a distro comes without python2 by default, there is no /usr/bin/python.

This patch changes the default binary in virtualenvwrapper RPM package in Fedora to work properly in python3-only environment.

IMHO virtualenvwrapper should check whether python3 is available or not and if so, use them. Otherwise, use a fallback to python2.

Doug Hellmann

Feb 2, 2019, 11:19:16 AM2/2/19
I think we would be happy to review patches to add that feature. Let us know if you’re interested in working on it and need help getting started.


Lumír Balhar

Feb 19, 2019, 8:48:24 AM2/19/19
to virtualenvwrapper
I've prepared a pull request:

Dne sobota 2. února 2019 17:19:16 UTC+1 Doug Hellmann napsal(a):
Reply all
Reply to author
0 new messages