Skip to content

Cannot create venv using Python 3.12 #133

Closed

Description

@affanadly

I can't seem to create virtual environments using Python 3.12 via pymanager as the files venvwlauncher.exe and venvlauncher.exe seems to be missing.

Steps to reproduce the behavior:

  1. Install Python 3.12 via pymanager: py install 3.12
  2. Create virtual environment with Python 3.12: py -3.12 -m venv .venv

The following error is given:

Unable to copy 'C:\\Users\\<user>\\AppData\\Local\\Python\\pythoncore-3.12-64\\venvwlauncher.exe'
Unable to copy 'C:\\Users\\<user>\\AppData\\Local\\Python\\pythoncore-3.12-64\\venvlauncher.exe'
Error: [WinError 2] The system cannot find the file specified

Activity

  1. zooba commented on Jun 13, 2025

    @zooba
    Member

    Thank you for finding this! I can't believe it slipped through, I know I tested it at various times.

    It looks like when free-threading support was added, the venv scripts were no longer renamed from venvlauncher to python during build, but for repackaging older versions the new script was used.

    I'll need to repackage those releases, which is a bit annoying, but unavoidable it seems. In the meantime, this Powershell command will fix up any installs:

    ("3.12", "3.11") | %{ py list --only-managed -q -f=prefix $_ } | %{ dir "$_\Lib\venv\scripts\nt\venv*launcher.exe" } | %{ mv $_ (Join-Path $_.Directory @{'venvlauncher.exe'='python.exe'; 'venvwlauncher.exe'='pythonw.exe'}[$_.Name]); Write-Host "Fixed $_" }
    
  2. self-assigned this
    on Jun 13, 2025
  3. zooba commented on Jun 13, 2025

    @zooba
    Member

    Oh, and in case anyone notices that the error message refers to the prefix directory instead of Lib\venv\scripts\nt, it's because the first failure is swallowed and the second attempt (assuming it's a source tree) is reported. Once we find the file in the right place, the case that's being reported isn't even checked.

  4. zooba commented on Jun 13, 2025

    @zooba
    Member

    Thanks for the report. I'm going through and republishing the 3.11 and 3.12 packages right now, so an alternative fix will (soon) be to py install 3.12 --force to replace your existing install. The Powershell command above will be faster, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions