Article

Setting up Jupyter Notebook

Installing Jupyter Notebook with Anaconda or Miniconda.

Introduction

We recommend installing Jupyter Notebook as part of either Anaconda or as an addition to Miniconda. Jupyter Notebook can be installed separately, but having either Anaconda or Miniconda already installed makes installing Jupyter Notebook easier.

Chromebook users, please see this article because the installation process is slightly different.

Anaconda, Miniconda, and Conda

Anaconda is a Python and R distribution that comes with all the tools you need to start working with data, including packages, development environments, and more. However, it requires a lot of memory (3 GB). Miniconda is a “minimal” version of Anaconda that requires less memory (about 50 MB) but does not come with any packages or environments pre-installed.

Both Anaconda and Miniconda come with conda. Conda is a package manager. Package managers help with installing, updating, and removing packages. Pip is another popular package manager, and we will use both. The difference between conda and pip is that conda manages packages and environments in any language (including Python), whereas pip only manages Python packages.

We will use pip to manage Python packages since it is the method recommended by the Python Packaging Authority. Conda’s role in our workflow is to manage Jupyter Notebook.

What should I install?

If you have 3 GB of space on your computer and want the most straightforward installation, install Anaconda. Scroll to the Windows Anaconda or Mac Anaconda section below.

If you do not have 3 GB of space available or you want to save space and don’t mind doing some manual work, install Miniconda. Scroll to Windows Miniconda or Mac Miniconda

Windows

You will need to know what System type (number of bits) you have before downloading the package (for more on bits, see here). If you are unsure, let’s check!

On Windows 10 and Windows 8.1:

  1. Select the Start button, then select Settings > System > About.
  2. At the right, under Device specifications, see System type.

On Windows 7:

  1. Select the Start button, right-click Computer, and then select Properties.
  2. Under System, see the System type.

Screenshot of Windows device specifications where system type is '64-bit operating system, x64-based processor'

Windows Anaconda

Go to the Anaconda Downloads page and download the appropriate version of Anaconda (32- or 64-Bit Graphical Installer)

  1. Double click on the .exe file and click Install.
  2. Read and agree to the licensing terms.
  3. Select if you want to install for ‘Just Me’ or ‘All Users’. If you are installing for ‘All Users’, you must have Administrator privileges.
  4. You will be prompted to select the installation location. By default, Anaconda should try to install in your home directory. We recommend accepting this default. Click Install.
  5. You will be asked if you want to add Anaconda to your PATH environment variable. Do not add Anaconda to the PATH because it can interfere with other software.
  6. You will be asked if you want Anaconda to be your default version of Python. We recommend ‘Yes’. There are some rare instances where you might not make Anaconda the default version, but they are beyond the scope of this article.
  7. Click the Install button.
  8. Go ahead and finish the installation.

Now you can verify your installation. Go to the Windows Start menu and search for ‘Anaconda Navigator’ (not the Anaconda Prompt).

anaconda navigator icon

If it appears, it is installed. Congratulations!

Double click on it, and the Anaconda Navigator window should appear.

Anaconda navigator prompt with menu of 'Home,' 'Environments,' 'Learning,' and 'Community' are listed. In Home, a few applications are visible, including JupyterLab and Jupyter Notebook.

Your applications screen may look slightly different from this one, but that is ok. Click the Launch button under Jupyter Notebook. A Jupyter Notebook interface will appear in your default browser.

Jupyter Notebook file directory

An Anaconda Prompt might also open and display a url. If it does, do not close it until you are done working with Jupyter Notebook. If it does not appear, don’t worry - this has to do with your operating system and will not affect Jupyter Notebook’s performance.

Congratulations!! You are ready to move on to the next article and get started using Jupyter Notebook!

Windows Miniconda

Go to the Miniconda Downloads page. Download the appropriate (32- or 64-Bit) Python 3.X version of Miniconda.

  1. Double click on the .exe file and click Install.
  2. Read and agree to the licensing terms.
  3. Select if you want to install for ‘Just Me’ or ‘All Users’. If you are installing for ‘All Users’, you must have Administrator privileges.
  4. You will be prompted to select the installation location. By default, Anaconda should try to install in your home directory. We recommend accepting this default. Click Install.
  5. You will be asked if you want to add Anaconda to your PATH environment variable. Do not add Anaconda to the PATH because it can interfere with other software.
  6. You will be asked if you want Anaconda to be your default version of Python. We recommend ‘Yes’. There are some rare instances where you might not make Anaconda the default version, but they are beyond the scope of this article.
  7. Click the Install button.

First, let’s verify that Miniconda was installed. We will use the Anaconda Prompt (miniconda3) Go to the Start Menu and search for the Anaconda Prompt. Anaconda Prompt is the Command Line Interface (CLI) we will use with Miniconda (more about the Command Line). In the shell, type:

conda --version

Anaconda Prompt showing conda version 4.9.2

A number should be returned. This is the version number of conda that you have installed.

Now we need to install a few key packages. In the Anaconda Prompt, type

conda install jupyter

When prompted with ‘Proceed ([y]/n)?’ type y

screenshot of terminal to conda install jupyter in which the user is asked whether to proceed with updating packages ca-certificates, certify, and openssl

Once the installation completes, in the Anaconda Prompt, type:

jupyter notebook

A Jupyter Notebook interface will appear in your default browser.

Jupyter Notebook file directory

An Anaconda Prompt might also open and display a url. If it does, do not close it until you are done working with Jupyter Notebook. If it does not appear, don’t worry — this has to do with your operating system and will not affect Jupyter Notebook’s performance.

terminal showing Jupyter Notebook running with possible localhost urls

Let’s install a few packages to get you started working with data in Jupyter Notebook. These are all Python packages, so we will use pip instead of conda to install them.

We will load:

Note that some of these packages depend on other packages. For example, scikit-learn requires NumPy (among others). Package managers (like pip) automatically find all the dependencies and install them for you. So when you install scikit learn, pip automatically installs NumPy, and any other dependencies scikit-learn needs.

Open a new Anaconda Prompt and type the following commands (hit ‘Enter’ after each row):

pip install pandas pip install scikit-learn pip install matplotlib pip install seaborn pip install nltk pip install beautifulsoup4

You can check to be sure these are all installed by starting Python in your Anaconda Prompt.

On a new line, type python

The header will change to be >>>:

terminal showing python version “Python 3.8.5”

You can import each package on a separate line or take a shortcut and import them all at once. Type:

import pandas import sklearn import matplotlib import seaborn import nltk import bs4

Or:

import pandas, sklearn, matplotlib, seaborn, nltk, bs4

the import statement: import pandas, sklearn, matplotlib, seaborn, nltk, bs4 is shown in a terminal window

If nothing happened, everything is installed perfectly, and you are ready to move on to the next article. Congratulations!!!

What if it didn’t work? You will probably get this error message:

ModuleNotFoundError: No module named MODULE

(Note that ‘packages’, ‘modules’, and ‘libraries’ all refer to the same thing.)

A user has run the statement import scikitlearn in a Python terminal. The terminal displays the following error: ModuleNotFoundError: No module named 'scikitlearn'

No worries — let’s debug! Usually, this is caused by a typo. There are two places to look:

  • your import statement
  • your installation statement

Check the import statement first. Try import MODULE, where MODULE is the module listed in the Error message. (In our case above, the statement import scikitlearn was the problem because scikit-learn must be imported with import sklearn.) If there is no typo there, go back to the installation step.

You will have to open a new Anaconda Prompt (this one is still running Python). Try importing the module specified in the error message using pip install MODULE. Then return to your window running Python and trying to import the module again.

If you are still having trouble, be sure to reach out on the Codecademy forum for help.

Mac

You will need to have access to your BASH or zsh Terminal. This is also called the Command Line Interface (CLI). If this is new to you, please see this article before proceeding.

Mac Anaconda

Go to the Anaconda Downloads page and download the 64-Bit Graphical Installer for Mac.

  1. Double click on the .pkg file and click Install.
  2. Read and agree to the licensing terms.
  3. Select if you want to install for ‘Just Me’ or ‘All Users’. If you are installing for ‘All Users’, you must have 4. Administrator privileges.
  4. You will be prompted to select the installation location. By default, Anaconda should try to install in your home directory. We recommend accepting this default. Click Install.
  5. You will be asked if you want to add Anaconda to your PATH environment variable. Do not add Anaconda to the PATH because it can interfere with other software.
  6. You will be asked if you want Anaconda to be your default version of Python. We recommend ‘Yes’. There are some rare instances where you would not make Anaconda the default version, but they are beyond the scope of this article.
  7. Click the Install button.
  8. You may be asked if you want to install PyCharm. PyCharm is another IDE (similar to Jupyter Notebook) but is not necessary right now.
  9. Go ahead and finish the installation.

Now you can verify your installation. Go to your Applications folder and double-click on Anaconda Navigator.

anaconda navigator icon

If the shortcut doesn’t appear (since Anaconda isn’t a regular program, it may appear differently depending on your operating system), click Command + Shift and search for ‘Anaconda Navigator’. If you have to do this, we recommend manually creating a shortcut to your Applications, Desktop, or any other folder you find convenient.

Double click on it, and the Anaconda Navigator window should appear.

Anaconda navigator prompt with menu of 'Home,' 'Environments,' 'Learning,' and 'Community' are listed. In Home, a few applications are visible, including JupyterLab and Jupyter Notebook.

Your applications screen may look slightly different from this one, but that is ok. Click the Launch button under Jupyter Notebook. A Jupyter Notebook interface will appear in your default browser.

Jupyter Notebook file directory

You may also notice that an Anaconda Prompt also opened. This needs to stay open while you are working in Jupyter Notebook. For more information about the features available in Anaconda, see the Anaconda Documentation.

terminal showing possible local host urls for running Jupyter Notebook

Congratulations!! You are ready to move on to the next article.

Mac Miniconda

Go to the Miniconda Downloads page. Download the Miniconda3 MacOSX 64-bit pkg

  1. Double click on the .pkg file and click Continue.
  2. Read and agree to the licensing terms.
  3. Select if you want to install for ‘Just Me’ or ‘All Users’. If you are installing for ‘All Users’, you must have Administrator privileges.
  4. You will be prompted to select the installation location. By default, Anaconda should try to install in your home directory. We recommend accepting this default. Click Install.
  5. You will be asked if you want to add Miniconda to your PATH environment variable. Do not add Miniconda to the PATH because it can interfere with other software.
  6. You will be asked if you want Miniconda to be your default version of Python. We recommend ‘Yes’. There are some rare instances where you would not make Miniconda the default version, but they are beyond the scope of this article.
  7. Click the Install button.

First, let’s verify that Miniconda was installed. Open a BASH or zsh terminal and type:

conda --version

A number should be returned. This is the version number of conda that you have installed.

terminal showing conda version 4.9.2

Now we need to install a few key packages. In the BASH or zsh terminal, type:

conda install jupyter

When prompted with ‘Proceed ([y]/n)?’ type y.

terminal displaying conda install jupyter option displaying ‘Proceed ([y]/n)?’: y

Once the installation completes, in the BASH or zsh terminal, type:

jupyter notebook

A Jupyter Notebook interface will appear in your default browser.

Jupyter Notebook file directory

You may also notice that the BASH or zsh terminal is now displaying a url. This needs to stay open while you are working in Jupyter Notebook.

terminal showing local host urls running Jupyter Notebook

Let’s install a few packages to get you started working with data in Jupyter Notebook. These are all Python packages, so we will use pip instead of conda to install them.

We will load:

Note that some of these packages depend on other packages. For example, scikit-learn requires NumPy (among other packages). Package managers (like pip) automatically find all the dependencies and install them for you. So when you install scikit-learn, pip automatically installs NumPy, and any other dependencies scikit-learn needs.

Open a new BASH or zsh terminal and type the following commands:

pip install pandas pip install sklearn pip install matplotlib pip install seaborn pip install nltk pip install beautifulsoup4

terminal showing pip install packages: pandas, sklearn, matplotlib, seaborn, nltk, beautiful soup with a final statement 'Successfully installed MODULE" after each package has been installed

You can check to be sure these are all installed by starting Python in your Terminal.

On a new line, type python.

The header will change to >>>

terminal showing “Python 3.8.5” and Anaconda after user has typed "python"

You can import each package on a separate line or take a shortcut and import them all at once.

import pandas import sklearn import matplotlib import seaborn import nltk import bs4

Or:

import pandas, sklearn, matplotlib, seaborn, nltk, bs4

terminal showing import pandas, sklearn, matplotlib, seaborn, nltk, bs4 and new line

What if they are not installed correctly? You will get this error message:

ModuleNotFoundError: No module named MODULE

(Note that ‘packages’ and ‘modules’ are the same thing.)

A user has run the statement import scikitlearn in a Python terminal. The terminal displays the following error: ModuleNotFoundError: No module named 'scikitlearn'

No worries — let’s debug! Usually, this is caused by a typo. There are two places to look:

  • your import statement
  • your installation statement

Check the import statement first. Try import MODULE, where MODULE is the module listed in the Error message. (In our case above, the statement import scikitlearn was the problem because scikit-learn must be imported with import sklearn.) If there is no typo there, go back to the installation step.

You will have to open a new Anaconda Prompt (this one is still running Python). Try importing the module specified in the error message using pip install MODULE. Then return to your window running Python and trying to import the module again.

If you are still having trouble, be sure to reach out on the Codecademy forum for help.

Next Steps

Now that you have a development environment installed on your computer, you are ready to start working locally! For more on using Jupyter, see the next article.

Ready to Learn More?

Find the course that's right for you! Explore our catalog or get a recommendation.
Course

Python Fundamentals

Beginner friendly

15 Lessons
Path

Data Analyst

Beginner friendly

67 Lessons
Path

Learn Data Analysis for your Business

Beginner friendly

67 Lessons