poetry install succeeded, python still says ModuleNotFoundError: two environments, one shell
Problem
poetry install printed the full resolution and install, exit code 0. Then:
ModuleNotFoundError: No module named 'myapp'Reinstalling, clearing caches, deleting the lockfile: all no-ops. The package was installed. Just not where my terminal was looking.
Root cause
Poetry installs into ITS OWN virtualenv, tucked away under ~/Library/Caches/pypoetry/virtualenvs/ (macOS) or ~/.cache/pypoetry/virtualenvs/ (Linux), named after the project plus a random suffix. Your shell's python is a different interpreter entirely: system Python, a pyenv shim, or some venv you activated last Tuesday and forgot. Poetry never touches your shell's activation state. So install and run succeed in two disjoint worlds.
✅ verified against poetry 1.2
poetry env info --path # the env poetry actually installed into
… 1 more line in the fix🔒 the fix — including 4 code blocks — is members-only. $1/mo unlocks everything.