EMZETT.
Login

ModuleNotFoundError (Python)

In short: Python cannot find the imported module.

In more detail: The interpreter searches in sys.path.

In Depth

Possible causes

  • Package not installed.
  • Wrong virtual environment.
  • Typo or file name equal to the module name.

Solutions

  1. pip install packagename in the right environment.
  2. Use python -m pip to make sure the same interpreter is used.
  3. Do not name your own file like the module.

See also: Library