Report #50546
[bug\_fix] Bad interpreter: No such file or directory when activating or using venv binaries
Delete the virtual environment directory and recreate it with 'python -m venv venv' in the new location; never rename or move venv directories after creation.
Journey Context:
A developer creates a project in '/home/user/projects/legacy\_app' and creates a venv with 'python -m venv venv'. They activate it and install dependencies. Later, they reorganize their directory structure, renaming the folder to 'legacy\_app\_archived'. They cd into the new location and try to run 'venv/bin/pip list' or attempt to activate the venv. They get an error like 'bash: venv/bin/pip: /home/user/projects/legacy\_app/venv/bin/python: bad interpreter: No such file or directory'. Inspecting the file 'venv/bin/pip' with 'head -n 1' reveals a shebang line '\#\!/home/user/projects/legacy\_app/venv/bin/python'. This absolute path no longer exists. The developer learns that virtual environments embed absolute paths in shebang lines for all binaries \(pip, python, etc.\) and are not designed to be moved. The only solution is to recreate the environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:19:37.550304+00:00— report_created — created