This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: -mvenv vs minor python version updates
Type: behavior Stage: resolved
Components: Installation, Interpreter Core, Library (Lib) Versions: Python 3.6, Python 3.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Ric Anderson, ronaldoussoren, uranusjr
Priority: normal Keywords:

Created on 2017-11-27 17:46 by Ric Anderson, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (7)
msg307072 - (view) Author: Ric Anderson (Ric Anderson) Date: 2017-11-27 17:46
When a site updates python3 from 3.5 to 3.6 (based on, this is would be a minor version update),pre-upgrade venv setups created with "python3 -menv ..." break because "python3" in the venv is really 3.5, and needs the system, which is no longer in the library search list.

Should "python -mvenv ..." copy the to the venv directory/lib, or add the system path to to LD_LIBRARY_PATH, or should the minor version number (.5 ,or .6) be excluded from the library name, so that minor version updates don't break existing venv setups or ???
msg307233 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2017-11-29 15:18
This is the expected behavior, the upgrade from 3.5 to 3.6 is a feature update that is (in general) not expected to be binary compatible with the previous release.
msg307326 - (view) Author: Ric Anderson (Ric Anderson) Date: 2017-11-30 16:20
Okay, are virtual env's expected to not be compatible as well?  

E.g., I built a venv under 3.5; venv copied in the 3.5 python executable, but not the needed library; should not -mvenv also copy libpython3.5 into the virutal setup or at least include the LD_LIBRARY_PATH to libpython3.5 in bin/activate, so that myenv/bin/python3.5 can find its needed library?
msg307358 - (view) Author: Tzu-ping Chung (uranusjr) * Date: 2017-12-01 04:34
Not sure if it’s the same thing, but I want to plug in that this can happen when you do a micro upgrade (e.g. 3.5.1 → 3.5.2) as well. This is because micro updates sometimes bump versions of dependencies (e.g. OpenSSL, Tk), and that breaks theirs links in the venv. Should this also be expected?
msg307371 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2017-12-01 09:22
The virtualenv (both using venv and using the third party library virtualenv) still relies on most of the python installation outside of the virtualenv, in particular the stdlib extensions. Those are not guartanteed to be binary compatible between feature releases (3.5 -> 3.6), but should be compatible with bug fix releases (3.6.1 -> 3.6.2).

Micro updates should work without breaking virtual environments, the venv doesn't include links to 3th party libraries by default (including openssl and the like). Doing larger upgrades of dependencies in micro updates can still break stuff though, but there's not much that the CPython team can do about that (unless we're doing incompatible updates of dependencies in the installers).
msg307387 - (view) Author: Tzu-ping Chung (uranusjr) * Date: 2017-12-01 13:45
Hmm, I’m quite sure I have experience that a virtual environment breaks after a micro version upgrade on macOS, getting an “image not found” or something similar. I’m not using the official released Python, but via Homebrew, so maybe this does not happen with the official distribution? I vaguely remember getting into a similar problem on Windows as well though…

I don’t have a handy environment set up for reproduction right now. I will try to report any problem if I run into this again in the future.
msg307390 - (view) Author: Ric Anderson (Ric Anderson) Date: 2017-12-01 14:44
well then, I guess y'all can close this ticket
Date User Action Args
2022-04-11 14:58:54adminsetgithub: 76332
2017-12-01 15:07:16ronaldoussorensetstatus: open -> closed
resolution: not a bug
stage: resolved
2017-12-01 14:44:44Ric Andersonsetmessages: + msg307390
2017-12-01 13:45:45uranusjrsetmessages: + msg307387
2017-12-01 09:22:50ronaldoussorensetmessages: + msg307371
2017-12-01 04:34:54uranusjrsetnosy: + uranusjr
messages: + msg307358
2017-11-30 16:20:46Ric Andersonsetmessages: + msg307326
2017-11-29 15:18:30ronaldoussorensetnosy: + ronaldoussoren
messages: + msg307233
2017-11-27 17:46:19Ric Andersoncreate