8000 MSYS2 (MinGW32/64 or UCRT64) fails on Create virtual environment .venv · Issue #24792 · microsoft/vscode-python · GitHub
[go: up one dir, main page]

Skip to content

MSYS2 (MinGW32/64 or UCRT64) fails on Create virtual environment .venv #24792

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

Closed
truongan012 opened this issue Feb 6, 2025 · 7 comments · Fixed by #25062
Closed

MSYS2 (MinGW32/64 or UCRT64) fails on Create virtual environment .venv #24792

truongan012 opened this issue Feb 6, 2025 · 7 comments · Fixed by #25062
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@truongan012
Copy link

#@@type: Bug

Reproduced:

  1. Create python virtual environment
  2. Select python from msys2
  3. Wait for creation and error popped up.

Extension version: 2024.22.2
Visual Studio Code 1.96.4
OS version: Windows 11 Pro 24H2 26100.2894

Untitled.video.-.Made.with.Clipchamp.mp4

Logs

2025-02-06 22:09:26.846 [info] Selected workspace c:\Users\ltan\Workspaces\PythonServerTest for creating virtual environment.
2025-02-06 22:09:26.848 [info] Native locator: Refresh started
2025-02-06 22:09:26.958 [info] Native locator: Refresh finished in 111 ms
2025-02-06 22:09:29.272 [info] Selected interpreter C:\msys64\ucrt64\bin\python3.12.exe for creating virtual environment.
2025-02-06 22:09:29.338 [info] Running Env creation script:  [
  'C:\\msys64\\ucrt64\\bin\\python3.12.exe',
  'c:\\Users\\ltan\\.vscode\\extensions\\ms-python.python-2024.22.2-win32-x64\\python_files\\create_venv.py',
  '--git-ignore'
]
2025-02-06 22:09:29.338 [info] > C:\msys64\ucrt64\bin\python3.12.exe ~\.vscode\extensions\ms-python.python-2024.22.2-win32-x64\python_files\create_venv.py --git-ignore
2025-02-06 22:09:29.339 [info] cwd: .
2025-02-06 22:09:29.571 [info] Running: C:\msys64\ucrt64\bin\python3.12.exe -m venv .venv
2025-02-06 22:09:34.373 [info] CREATED_VENV:C:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe
2025-02-06 22:09:34.373 [info] Creating: C:\Users\ltan\Workspaces\PythonServerTest\.venv\.gitignore
2025-02-06 22:09:34.374 [info] CREATE_VENV.UPGRADING_PIP
Running: C:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe -m pip install --upgrade pip
2025-02-06 22:09:34.375 [info] Traceback (most recent call last):
  File "c:\Users\ltan\.vscode\extensions\ms-python.python-2024.22.2-win32-x64\python_files\create_venv.py", line 262, in <module>
2025-02-06 22:09:34.375 [info]     main(sys.argv[1:])
2025-02-06 22:09:34.375 [info]   File "c:\Users\ltan\.vscode\extensions\ms-python.python-2024.22.2-win32-x64\python_files\create_venv.py", line 245, in main
2025-02-06 22:09:34.375 [info]     upgrade_pip(venv_path)
  File "c:\Users\ltan\.vscode\extensions\ms-python.python-2024.22.2-win32-x64\python_files\create_venv.py", line 134, in upgrade_pip
2025-02-06 22:09:34.375 [info]     run_process(
  File "c:\Users\ltan\.vscode\extensions\ms-python.python-2024.22.2-win32-x64\python_files\create_venv.py", line 96, in run_process
2025-02-06 22:09:34.376 [info]     subprocess.run(args, cwd=os.getcwd(), check=True)  # noqa: PTH109
2025-02-06 22:09:34.376 [info]     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-06 22:09:34.376 [info] ^^^
  File "C:\msys64\ucrt64\lib\python3.12\subprocess.py", line 548, in run
2025-02-06 22:09:34.376 [info]     with Popen(*popenargs, **kwargs) as process:
2025-02-06 22:09:34.376 [info]          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\msys64\ucrt64\lib\python3.12\subprocess.py", line 1026, in __init__
2025-02-06 22:09:34.377 [info]     self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\msys64\ucrt64\lib\python3.12\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
2025-02-06 22:09:34.411 [error] Error while running venv creation script:  undefined
2025-02-06 22:09:34.412 [error] Failed to create virtual environment with exitCode: 1
2025-02-06 22:18:35.461 [error] Invalid version for c:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe: {"name":".venv","location":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","kind":"virt-venv","id":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","executable":{"filename":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","sysPrefix":"C:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python","type":"Virtual"}
2025-02-06 22:18:47.303 [error] Invalid version for c:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe: {"name":".venv","location":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","kind":"virt-venv","id":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","executable":{"filename":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","sysPrefix":"C:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python","type":"Virtual"}
2025-02-06 22:19:08.629 [error] Invalid version for c:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe: {"name":".venv","location":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","kind":"virt-venv","id":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","executable":{"filename":"c:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv\\Scripts\\python.exe","sysPrefix":"C:\\Users\\ltan\\Workspaces\\PythonServerTest\\.venv","ctime":-1,"mtime":-1},"version":{"sysVersion":null,"major":-1,"minor":-1,"micro":-1},"arch":1,"distro":{"org":""},"source":[],"detailedDisplayName":"Python","display":"Python","type":"Virtual"}

Please help to check it! Thanks!

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 6, 2025
@karthiknadig
Copy link
Member

@truongan012 What is the value of sys.executable for the case you have? it seems like it might be failing to find the executable. can you try running the python with this:

C:\msys64\ucrt64\bin\python3.12.exe -c "import sys;print(sys.executable)"

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 6, 2025
@karthiknadig karthiknadig self-assigned this Feb 6, 2025
@truongan012
Copy link
Author

Hi @karthiknadig,
It is,

-->  C:\msys64\ucrt64\bin\python3.12.exe -c "import sys;print(sys.executable)"
C:\msys64\ucrt64\bin\python3.12.exe

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 7, 2025
@karthiknadig
Copy link
Member

@truongan012 Thanks for checking that. Can you verify the following for me?

  1. Does this path exists C:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe
  2. What do you get if you run: C:\Users\ltan\Workspaces\PythonServerTest\.venv\Scripts\python.exe -m pip install --upgrade pip

If the path does NOT exist, can you share where the python.exe is under C:\Users\ltan\Workspaces\PythonServerTest\.venv

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 7, 2025
@truongan012
Copy link
Author
truongan012 commented Feb 9, 2025

Hi,
No, here it is

Image

Result I run with that path

C:\Users\ltan\Workspaces\PythonServerTest\.venv\bin\python.exe -m pip install --upgrade pip    
Requirement already satisfied: pip in c:\users\ltan\workspaces\pythonservertest\.venv\lib\python3.12\site-packages (25.0)

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 9, 2025
@karthiknadig
Copy link
Member

@truongan012 I see it uses bin, thanks for this detail.

@karthiknadig
Copy link
Member

@DonJayamanne This might be useful bit of detail about MSYS/UCRT python. On windows they use bin instead of Scripts directory.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on area-environments Features relating to handling interpreter environments and removed triage-needed Needs assignment to the proper sub-team labels Feb 10, 2025
@karthiknadig karthiknadig added this to the February 2025 milestone Feb 10, 2025
@karthiknadig karthiknadig modified the milestones: March 2025, April 2025 Mar 25, 2025
@karthiknadig karthiknadig modified the milestones: April 2025, May 2025 Apr 30, 2025
@s-kai273
Copy link

Hi, I fixed this bug on this PR by adjusting the venv path for the case when MSYS2 Python is used.

karthiknadig pushed a commit that referenced this issue May 13, 2025
@github-actions github-actions bot removed the needs PR Ready to be worked on label May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0