-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symlinks point to plain python3 executable instead of python3.x #1974
Comments
I'd guess this is one of thos works as expected and as designed. virtualenvs do not survive replacing your system python with another path. Not sure how we can do better per se here, without in general degrading performance. Instead of accepting the first found python interpreter executable we'd need to discover all, and then decide in between them. But now interpreter discovery always takes much longer 🤔 which I'd like to avoid. Can you provide a Docker image reproducible? |
Trying to resolve where |
We already should resolve the middleman, so here must be something else. The Python interpreter must be reporting the symlink is the host python (resolved). Please provide a reproducible for docker so we can better understand the issue. |
I have no experience with docker. |
You can replicate it with this dockerfile:
Just do:
And you will see that the virtualenvironmet using the default version of python, that is, python3.6, will have a symlink to python3 and not python3.6. The other one works just fine. |
Thanks can take that to investigate and use to validate the fix too. Feel free to start work on that if you have time, otherwise it hits the backlog, and hopefully someone picks it up eventually 👍 |
I don't think I can fix this (at least in a non-hacky way) since I just started using virtualenv, but I'll take a look. |
As a quick test, on
Being the second line the one that does the trick for me. Going a little bit further down the rabbit hole, I came across
When you say |
Oh, pure executable means the actual python executable (what we get from sys.executable/sys.base_executable), and not potentially any random shim scripts, e.g. for when people do something like:
|
As this is 3 years old without updates closing it. |
Issue
If you create an environment and you either don't specify a python version for it or specify the one which is set as default on the system, the symlinks point to
python3
instead ofpython3.x
. This leads to nasty bugs if you change your defaultpython3
with, lets say,update-alternatives
.Case 1: Default python version is
3.6
and we create an env with3.6
. The symlink point topython3
, therefore if you change the default version of python withupdate-alternatives
, this environment gets broken.Case 2: Default python version is
3.6
and we create an env with3.7
. The symlink point topython3.7
, therefor if you change the default version of python withupdate-alternatives
, this environment will be fine. This should be the expected behavior.Case 3: Default python version is
3.7
and we create an env with3.6
. The symlink point topython3.6
, which is what I expected on the case 1. This again produces an environment immune to the changes in the base system:Environment
Provide at least:
I hope this is detailed enough and that it is not a duplicated issue. I couldn't find another one like this.
Thanks!
The text was updated successfully, but these errors were encountered: