Skip to main content

How to Resolve "ModuleNotFoundError: No module named 'skimage'" in Python

The ModuleNotFoundError: No module named 'skimage' error in Python indicates that the scikit-image library, a powerful package for image processing, is not installed in your current Python environment.

This guide provides a complete explanation for resolving this error, including detailed installation instructions for various environments, troubleshooting tips, and verification steps.

Understanding the Error​

The ModuleNotFoundError means Python can't find a module named skimage when your code tries to import skimage.

  • This is almost always due to the package not being installed in the currently active environment, or a misconfiguration causing Python to look in the wrong place.
  • It could also be due to a naming conflict (shadowing).

Basic Installation with pip​

The standard and recommended way to install scikit-image is using pip:

pip install scikit-image
# OR, for Python 3 (might be pip3, pip3.10, etc. on your system)
pip3 install scikit-image

# OR, if pip is not in your PATH:
python -m pip install scikit-image
python3 -m pip install scikit-image

# OR, for Windows 'py' launcher:
py -m pip install scikit-image

Try each command in turn until one works. The python -m pip form is often most reliable as it uses the specific Python interpreter you intend.

Troubleshooting​

If you still get the ModuleNotFoundError after installation, work through these steps:

Virtual Environments (Essential!)​

Always use virtual environments for Python projects. This isolates dependencies.

  1. Create:

    python3 -m venv venv # Recommended. Uses built-in venv
    # OR (if the above fails)
    python -m venv venv
    # OR (Windows)
    py -m venv venv
  2. Activate:

    • Linux/macOS (bash/zsh): source venv/bin/activate

    • Windows (Command Prompt): venv\Scripts\activate.bat

    • Windows (PowerShell): venv\Scripts\Activate.ps1

      If you get a "running scripts is disabled" error in PowerShell, run this once (as administrator if necessary) and retry:

      Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
  3. Install inside the activated environment: pip install scikit-image

Checking Your Python Version​

Ensure you're installing with the correct Python version:

python --version # Or python3 --version, or py --version

If you have multiple Python versions, use the pip associated with the correct one (e.g., pip3.9 install scikit-image for Python 3.9).

Verifying the Installation​

Confirm that the package is installed and the location is correct.

pip show scikit-image
# OR
python -m pip show scikit-image

This should display package information, including the Location. It must be in your virtual environment's site-packages (if using a venv) or a standard Python installation location. If it says "Package not found," it's not installed in the current environment.

IDE Interpreter Configuration (VS Code, PyCharm)​

Your IDE must be configured to use the correct Python interpreter.

  • *VS Code: Use the Python: Select Interpreter command (Command Palette: Ctrl+Shift+P or Cmd+Shift+P).
  • *PyCharm: File > Settings > Project > Python Interpreter (or PyCharm > Preferences... on macOS).

Naming Conflicts (Shadowing)​

Crucially, make sure you don't have a file or directory named skimage.py (or just skimage) in your project directory or anywhere on your PYTHONPATH. This "shadows" the installed scikit-image package. Rename any such files/directories.

Reinstalling scikit-image​

If you suspect a corrupted installation:

pip uninstall scikit-image
pip install scikit-image

Upgrading Pip​

Make sure your pip is up to date. Run the following:

python -m pip install --upgrade pip

System Dependencies (Linux - Rare)​

On some Linux distributions, you might need system-level dependencies. This is less common with scikit-image than with some other scientific packages, but if you're still having trouble, try:

# Debian/Ubuntu
sudo apt update
sudo apt install build-essential python3-dev

Installation in Specific Environments​

Anaconda​

conda install -c anaconda scikit-image
  • Always use conda to manage packages in your conda environments.

Jupyter Notebook​

!pip install scikit-image
  • The exclamation mark will run the command as if it was run in the shell.

A Basic Example​

Once correctly installed, you can import and use skimage:

import skimage
print(skimage.__version__) # Check the version to verify import
# Example usage (requires matplotlib for display)
from skimage import data, io
import matplotlib.pyplot as plt

image = data.coins() # Load a sample image
io.imshow(image)
plt.show()

Conclusion​

The ModuleNotFoundError: No module named 'skimage' error is usually easy to fix.

The most common problems are:

  • incorrect installation (wrong environment).
  • IDE misconfiguration.
  • naming conflicts.

By carefully following the steps in this guide, especially using virtual environments and checking your interpreter settings, you can resolve the error and start using scikit-image for your image processing tasks.