AI Diagnostic Summary

ModuleNotFoundError: No module named

Well-Documented Error

This error matches known, documented patterns with reliable solutions.

Quick Fix (Most Common Solution)

Seeing "ModuleNotFoundError: No module named"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.

High confidence
What This Error Means

Python cannot find the module you are trying to import.

Frequently documented in developer and vendor support forums.

Based on documented solutions and common real-world fixes.
Not affiliated with browser, OS, or device manufacturers.

New here? Learn why exact error messages matter →

Common Causes
  • Package not installed with pip
  • Wrong Python environment active
  • Typo in module name
How to Fix
  1. Install with pip install module-name
  2. Activate correct virtual environment
  3. Check module name spelling

Last reviewed: April 2026 How we review solutions

Version note: Especially common after macOS Sonoma and Ventura updates, which may reset or relocate the system Python. Also frequent when switching between Python 3.8–3.12 due to renamed or removed stdlib modules.

Environment-Specific Commands

Linux

  1. python3 -m pip install module-name
  2. If using system Python: sudo apt install python3-module-name
  3. Or create a venv: python3 -m venv .venv && source .venv/bin/activate

macOS

  1. python3 -m pip install module-name
  2. If Homebrew Python: ensure /opt/homebrew/bin is in PATH
  3. pyenv users: pyenv rehash after installing packages

Windows

  1. py -m pip install module-name
  2. If multiple Python versions: py -3.11 -m pip install module-name
  3. Check PATH: where python should show your expected Python
Quick Diagnostic Path
  • If pip install succeeds but import still fails Run python -c "import sys; print(sys.executable)" to confirm pip and python point to the same installation
  • If Works in terminal but fails in IDE Check IDE Python interpreter setting — it may point to a different environment
  • If Error only in deployed/production environment Ensure requirements.txt is complete: pip freeze > requirements.txt and redeploy
If This Still Fails, Check
  • Module name differs from pip package name (e.g., import cv2 but pip install opencv-python)
  • Jupyter notebook using a different kernel than your terminal — run !pip install inside the notebook to match
  • Namespace packages (no __init__.py) can cause this in Python 3.3+ if the directory structure is wrong
Diagnosing mismatched pip and python
# Check which python is running
python3 -c "import sys; print(sys.executable)"
# /usr/bin/python3

# Check which pip is installing to
python3 -m pip --version
# pip 23.1 from /usr/lib/python3/dist-packages/pip

# Always use python3 -m pip to guarantee match
python3 -m pip install requests

Environment Differences

Virtual Environment Activation Is the Most Overlooked Fix

Python ModuleNotFoundError is almost always an environment mismatch: the pip that installed the package wrote to a different Python installation than the one running your script. On macOS with both system Python (/usr/bin/python3) and Homebrew Python (/opt/homebrew/bin/python3), running pip3 install requests may install to Homebrew Python while your script runs with system Python. Run which python3 and which pip3 and compare — they must point to the same location. Virtual environments solve this definitively: python3 -m venv .venv creates an isolated environment where pip and python always point to the same binary inside .venv/bin/. The activation step (source .venv/bin/activate on Unix, .venvScriptsactivate.ps1 on Windows PowerShell) must be run in every new shell session. VS Code and PyCharm detect .venv automatically. Jupyter notebooks add another layer: each kernel has its own Python environment. Installing a package in the terminal does not make it available to the notebook if the kernel uses a different Python. The fix is to install directly in the notebook with !pip install package or register the venv as a Jupyter kernel with python -m ipykernel install --user --name=myenv. Run import sys; print(sys.executable) in both your terminal and notebook to confirm they use the same Python binary.

Optional follow-up

Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.

Was this explanation helpful?

Explanations are based on documented fixes, real-world reports, and common system behavior. GetErrorHelp is independent and not affiliated with software vendors, device manufacturers, or service providers.
Frequently Asked Questions

Why is pip-installed module not found?

You may be using a different Python/pip than expected. Use pip3 or python -m pip.

How do I check installed packages?

Run pip list or pip freeze to see installed packages.

Related Resources

Also Known As

Common Search Variations

Related Errors
Still Stuck?

Paste a different error message or upload a screenshot to get help instantly.

Solutions are based on commonly documented fixes and may not apply in all situations.