Report #67614
[bug\_fix] venv activated but python/pip still points to system executable \(shell hash caching\)
Run \`hash -r\` in bash \(or \`rehash\` in zsh\) to clear the shell's command hash table, or open a new shell session. The root cause is that the shell caches the filesystem path to executables for performance; activating a venv prepends to \`PATH\`, but the cached hash still points to the system Python/pip until cleared.
Journey Context:
You create a fresh venv: \`python3 -m venv myenv\`. You activate it: \`source myenv/bin/activate\` \(or \`myenv\\Scripts\\activate\` on Windows\). Your prompt shows \`\(myenv\)\`. You run \`pip install requests\`. It reports "Requirement already satisfied" and points to \`/usr/lib/python3.9/site-packages\`. You panic. You run \`which python\` and it shows \`/usr/bin/python\` instead of \`myenv/bin/python\`. You check \`echo $PATH\` and see \`myenv/bin\` is indeed first. You search "venv activated but which python wrong" and find StackOverflow answers explaining the shell's hash table. You run \`hash -r\` \(or \`type -a pip\` to confirm the cache\). You run \`which python\` again and it correctly shows \`myenv/bin/python\`. The \`pip install\` now correctly installs into the venv.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T19:58:18.764264+00:00— report_created — created