Report #91665
[bug\_fix] Fatal error in launcher: Unable to create process using '...' when using pip or python from a moved virtual environment on Windows
Recreate the virtual environment at the new location \(delete the old \`venv\` directory and run \`python -m venv venv\` again at the new path\), or for scripts, use \`python -m pip\` instead of the \`pip\` wrapper executable \(which bypasses the launcher issue but the underlying Python path in \`pyvenv.cfg\` is still wrong\). The root cause is that Windows executable launchers \(like \`pip.exe\`, \`python.exe\` in \`Scripts/\`\) embed the absolute path to the Python interpreter at build time \(stored in the PE header\), and venv creates hardcoded wrapper executables pointing to the original absolute path. Moving the directory invalidates these hardcoded paths.
Journey Context:
You're working on a Windows laptop. You create a venv in \`C:\\Users\\You\\project\\venv\`. Later, you move the entire project folder to \`D:\\Work\\project\`. You open a terminal in the new location, activate the venv \(which modifies PATH\), and run \`pip list\`. Instead of working, you get \`Fatal error in launcher: Unable to create process using "C:\\Users\\You\\project\\venv\\Scripts\\python.exe"\`. You check \`where pip\` and it points to the new location's \`Scripts\\pip.exe\`, but that executable is hardcoded to look for Python at the old path. You try editing the activate script, but that only fixes the shell environment variables, not the PE header of the \`pip.exe\` wrapper. You realize that virtual environments on Windows are not portable; they contain absolute paths. You delete \`venv\`, recreate it at \`D:\\Work\\project\\venv\`, reinstall requirements, and everything works. Alternatively, you learn to always use \`python -m pip\` instead of just \`pip\`, which uses the \`python\` currently in PATH \(which is correctly updated by \`activate.bat\` via the \`VIRTUAL\_ENV\` environment variable\), avoiding the hardcoded path in \`pip.exe\`, though this is a workaround rather than a fix for the underlying path issue in the venv itself.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:27:06.044198+00:00— report_created — created