How to solve the no module named Seaborn error in Python?

Today’s tutorial is dedicated at solving import errors related to the Seaborn data visualization module.

Module not found errors are typically ubiquitous when starting to work with a new Python library (think Pandas, numpy, requests, matplotlib and others) in your development environment, or when you are installing a new environment from scratch either manually or using a predefined distribution like Anaconda.

Solving the Seaborn module not found

The typical reason for this error is that the seaborn package is not installed in your environment.

Before starting your troubleshooting, you might want to use the command pip list to find out the packages that are installed.

Seaborn not found error messages in Jupyter and Spyder

Below you can find a screenshot of the error message you’ll get in Jupyter Notebook / Labs.

And in Spyder:


You’ll encounter similar errors in PyCharm or other Python Integrated Development Environments.

Fix Seaborn import in Anaconda or Mini-Conda

If you are using Mini-Conda, proceed as following:

  • Save your work.
  • Close your Python notebook / Dev environment.
  • Open your Command Prompt / Terminal in macOS.
  • Type: conda activate <full os path to your Conda environment>. For example:
conda activate c:\envs\Python395
  • Hit Enter.
  • Then type pip install seaborn
  • The seaborn package will be collected from the Python package repository by the Python Package installer (pip) and installed.
  • Once successfully installed you’ll receive a message in your Mini-Conda prompt.
  • Type Exit and hit enter to exit the Minconda prompt.
  • Reopen your Notebook or Python Editor and import seaborn, by typing
import seaborn as sns

Note for Anaconda users: You can leverage the Anaconda Environment Manager that provides a graphical user interface to maintain your environment, including package installation and removal.

Use Pip install to fix Seaborn module not found error

If you are using an installation that you have manually configured using pip, you can use your operating system command prompt / terminal directly:

  • Save your work.
  • Exit your Jupyter Notebook or IDE.
  • Open the Windows command prompt (cmd).
  • In Windows type cd <full_path to your Python environment> – for example:
cd c:\My_Python_Env
  • Then type:
pip install seaborn
  • Hit Enter.
  • After seaborn is installed, type exit fand hit Enter.
  • Reopen your notebook and import seaborn by typing:
import seabon as sns

That’s it. Happy data visualization 🙂