Skip to content

Creating virtual environment failed when using uv in MSYS2 #1088

Description

@Tiphereth-A

Current Behavior

I am trying to build nox in MSYS2, and I have found that nox fails to create virtual environment when using MSYS2-build uv as the venv backend, whereas uv venv works fine.

Expected Behavior

nox should create venv successfully.

Steps To Reproduce

  1. Clone this repo
  2. Install all dependencies under MSYS2
  3. run python -m nox
  4. It reports
nox > Creating virtual environment (uv) using python.exe in .nox\_nox_script_mode
nox > Command uv venv -p 'C:\msys64\ucrt64\bin\python.exe' 'K:\nox\.nox\_nox_script_mode' --clear failed with exit code 2:
nox > error: Failed to inspect Python interpreter from provided path at `C:\msys64\ucrt64\bin\python.exe`
  Caused by: Can't use Python at `C:\msys64\ucrt64\bin\python.exe`
  Caused by: Unknown operating system: `mingw_x86_64_ucrt_gnu`

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "K:\nox\nox\__main__.py", line 34, in <module>
    main()
    ~~~~^^
  File "K:\nox\nox\_cli.py", line 204, in nox_main
    _main(main_ep=True)
    ~~~~~^^^^^^^^^^^^^^
  File "K:\nox\nox\_cli.py", line 267, in _main
    run_script_mode(
    ~~~~~~~~~~~~~~~^
        noxfile,
        ^^^^^^^^
    ...<4 lines>...
        download_python=download_python,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "K:\nox\nox\_cli.py", line 171, in run_script_mode
    venv.create()
    ~~~~~~~~~~~^^
  File "K:\nox\nox\virtualenv.py", line 879, in create
    nox.command.run(cmd, silent=True, log=nox.options.verbose or False)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "K:\nox\nox\command.py", line 208, in run
    raise CommandFailed(msg)
nox.command.CommandFailed: Returned code 2

Environment

- OS: Windows 11
- Python: 3.14.4 (MSYS2)
- Nox: master (71eb5242f76ef89e8f0629fdef1541b3226fdc76)
- uv: 0.11.7 (9d177269e 2026-04-15 x86_64-pc-windows-gnu)

Anything else?

I have made a patch to fix that in msys2/MINGW-packages#28759, and I could create a PR to sync this if you'd like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions