Visitar URL original
sys.executable is broken in VirtualEnv in Windows for Python 3.11 using Nushell · Issue #102496 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20260312123105/https://github.com/python/cpython/issues/102496
Skip to content
/ cpython Public

sys.executable is broken in VirtualEnv in Windows for Python 3.11 using Nushell #102496

@presidento

Description

@presidento

Bug report

Minimal reproducible example in Windows:

> py -3.11 -m venv .venv
> nu # <---- start Nushell
> .venv/Scripts/python.exe  -c "import sys; print(sys.version, sys.executable)"
3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] \\?\C:\Users\MFarkas\git\python-bug\.venv\Scripts\python.exe

Your environment

Nushell 0.76.0, Windows 10 64bit. It works perfectly with system Pythons (no virtualenv), or in virtualenv except for Python 3.11 (this is why I think it is something related to Python, and not only to Nushell):

System Pythons
3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python36\python.exe
3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python37\python.exe
3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python38\python.exe
3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python39\python.exe
3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python310\python.exe
3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] C:\Users\MFarkas\AppData\Local\Programs\Python\Python311\python.exe

VirtualEnv Pythons
3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] C:\Users\MFarkas\git\python-bug\3.6\Scripts\python.exe
3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] C:\Users\MFarkas\git\python-bug\3.7\Scripts\python.exe
3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] C:\Users\MFarkas\git\python-bug\3.8\Scripts\python.exe
3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] C:\Users\MFarkas\git\python-bug\3.9\Scripts\python.exe
3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)] C:\Users\MFarkas\git\python-bug\3.10\Scripts\python.exe
3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] \\?\C:\Users\MFarkas\git\python-bug\3.11\Scripts\python.exe

Because of this, some packages cannot be installed with pip. And everything is broken which needs to have a valid sys.executable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixesOS-windowsextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions