[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: > So I'm +1 on fixing this by calling realpath. In POSIX, calculate_path() in Modules/getpath.c calls calculate_argv0_path() before it calls calculate_read_pyenv(), and calculate_argv0_path() in turn calls resolve_symlinks(&calculate->argv0_path). Thus "pyvenv.cfg

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Paul Moore
Paul Moore added the comment: I'm inclined to think that creating a venv from within another venv should be allowed. Tools like pipx can result in *other* tools being run from within a virtual environment, and I don't think it's good to disallow that usage - as an example, I have virtualenv,

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Steve Dower
Steve Dower added the comment: Thanks for figuring that out, Eryk. Probably we should just update venv to do a realpath(sys._base_executable) to handle the venv-from-symlinked-venv scenario. Though I'd also be quite happy to just disallow that entirely (as we used to?). If you enable system

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: This issue is partly due to bpo-8901, which changed the behavior of the -E and -I command-line options to make them ignore the default PythonPath value in the registry key "Software\Python\PythonCore\X.Y\PythonPath". The change itself is not wrong. It's just expos

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg378489 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: > Well, actually the environment variables /should/ not matter as -I > implies -E. The operative word there is "should". I was grasping for anything that might explain why I couldn't reproduce the issue. > Ok, the missing link is that the python you run into need

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor
Bernat Gabor added the comment: > We need more information about the specific environment this is triggering. Both Gitub Actions Windows CPython3.9 or installer as downloaded from (on Windows 10) https://www.python.org/downloads/release/python-390/. > PYTHONHOME should not be set all. PYTHON

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor
Bernat Gabor added the comment: Ok, the missing link is that the python you run into needs to be also a symlink venv: ❯ py -m venv env --without-pip --clear --symlinks ❯ .\env\Scripts\python.exe -c "import venv, subprocess; venv.EnvBuilder(with_pip=False, symlinks=True).create('venv'); subpr

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Filipe Laíns
Filipe Laíns added the comment: Well, actually the environment variables /should/ not matter as -I implies -E. -- ___ Python tracker ___ ___

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Filipe Laíns
Filipe Laíns added the comment: This error most likely happens because sys.path isn't being set properly and the standard library isn't being included. We need more information about the specific environment this is triggering. Which CPython build are you using? The one from Github Actions, r

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: What about the PYTHONHOME and PYTHONPATH environment variables? >>> 'PYTHONHOME' in os.environ False >>> 'PYTHONPATH' in os.environ False PYTHONHOME should not be set all. PYTHONPATH needs to be set carefully. It should never include standard-libra

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor
Bernat Gabor added the comment: ❯ py -c 'import sys; print(sys.version)' 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] -- ___ Python tracker __

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Eryk Sun
Eryk Sun added the comment: I can't reproduce the issue with the normal 3.9.0 distribution from python.org. For example: >>> venv.EnvBuilder(with_pip=False, symlinks=True).create("venv") >>> subprocess.check_call(["venv\\Scripts\\python.exe", "-Ic", "import sys; print(sys.executable)

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor
Change by Bernat Gabor : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker ___ ___ Py

[issue42013] venv on Windows with symlinks is broken if invoked with -I

2020-10-12 Thread Bernat Gabor
New submission from Bernat Gabor : Here's a small reproducible, run it on a Windows OS that has symlinks enabled: import shutil import venv import subprocess shutil.rmtree("venv", ignore_errors=True) venv.EnvBuilder(with_pip=False, symlinks=True).create("venv") # works subprocess.check_call([