[Tutor] Need help with a virtual environment mess

Mats Wichmann mats at wichmann.us
Mon May 7 13:02:44 EDT 2018

On 05/07/2018 10:16 AM, Jim wrote:

> My understanding of VE's, based on some feedback from here, is you
> install install the python you want on the system then use it to install
> your VE. Then you install what ever you need to the VE. In my case I had
> a working VE based on python 3.5 then I received an upgrade to the
> python version 3.6 I had installed. After that I had problems with the
> 3.5 VE that had been working.

yes, this happens.

the default behavior for virtualenv is to make links when creating the
VE, which saves copying things but is vulnerable to breakage if the
Python it's linking to receives major changes.  In the case of a
distribution upgrading the Python version, a VE constructed against the
old version will break if the links are version-specific.  Looking at
one virtualenv I have, {VEPATH}/lib/python3.6 is full of such symlinks,

lrwxrwxrwx.  1 mats mats    26 Aug 17  2017 re.py ->

Virtualenvs are cheap to recreate, so one approach is to just throw away
the old one and make a new one.

you can also give virtualenv an option (--always-copy) to cause the
created virtualenv to be more self-contained, at a cost of some space
and tiem.

There are plenty of tools for managing python versions and virtualenv.
The python community changed directions a little bit recently, 'venv' is
now the recommended approach:


pyenv can manage different Python versions if you're interested in that.

More information about the Tutor mailing list