ModuleNotFoundError: You Installed It Somewhere Else

Symptom

"pip install x" succeeded; "import x" still fails.

Root cause

pip installed into a different interpreter/venv than the one running the code.

Fix, in order

1. Check which python is actually runningimport sys; print(sys.executable)
2. Install with that exact interpreterpython -m pip install <pkg>
3. Verify where the package landedpip show <pkg> | grep Location

Prevent it coming back

Always python -m pip, never bare pip.

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

DevOps tools shelf

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog