What Jupyter Notebook is and why you'd install it

Jupyter Notebook is a tool that runs in your web browser and lets you write code, see the results when ready below it, and add notes in between — all in one document. If you write Python code for data analysis, machine learning, or testing ideas, Jupyter lets you run one section at a time instead of running an entire script from top to bottom. You see what each piece does before moving to the next.

You install Jupyter on your own computer so you own the environment where your code runs. Nothing uploads to the internet unless you choose to share the file. It works offline, and you control which Python packages are available to your code.

Key Takeaways

  • Jupyter Notebook requires Python to be installed first — check whether you have it by opening your terminal or command prompt and typing python --version.
  • The standard way to install Jupyter is through pip, Python's package manager, using the command pip install jupyter.
  • After installation, you start Jupyter by typing jupyter notebook in your terminal, which opens a browser window showing your computer's file system.
  • You create a new notebook file from the browser interface, and Jupyter saves it as a .ipynb file that contains your code, output, and notes together.
  • If pip installation fails, Anaconda is an alternative that bundles Python, Jupyter, and common data science packages in one installer.

Check whether Python is already on your computer

Jupyter runs on top of Python, so you need Python installed first. Open your terminal (on Mac or Linux) or Command Prompt (on Windows) and type this exactly:

python --version

If you see a version number like Python 3.9.0 or higher, you have Python. If you see "command not found" or "is not recognized", Python is not installed or not in your system path. In that case, read Python from python.org, run the installer, and make sure to check the box that says "Add Python to PATH" during installation on Windows.

Install Jupyter using pip

Once Python is confirmed, open your terminal or Command Prompt again and type:

pip install jupyter

Pip downloads Jupyter and all the packages it depends on. This usually takes a few minutes. When it finishes, you should see a message saying the installation succeeded. If you see an error about permissions, try pip install --user jupyter instead, which installs Jupyter for your user account only.

On some computers, the command might be pip3 instead of pip, especially if you have both Python 2 and Python 3 installed. If pip install jupyter fails, try pip3 install jupyter.

Start Jupyter Notebook for the first time

In your terminal or Command Prompt, type:

jupyter notebook

Jupyter starts a small server on your computer and automatically opens a browser window. You see a file browser showing the contents of the folder where you ran the command. The URL in the address bar looks something like http://localhost:8888 — that's your computer talking to itself, not the internet.

If the browser doesn't open automatically, copy the URL from the terminal output and paste it into your browser's address bar. You can now create a new notebook or open an existing one.

Create and save your first notebook

In the browser window, click the "New" button in the top right and select "Python 3" (or whichever Python version you have). A new tab opens with a blank notebook. The notebook has cells — boxes where you type code. Type some Python code in the first cell, like print("Hello"), then press Shift+Enter to run it. The output appears directly below the cell.

Jupyter saves your notebook automatically every few minutes as a file with the .ipynb extension. You can also save manually by pressing Ctrl+S (or Cmd+S on Mac). The file lives in the same folder where you ran jupyter notebook. You can move the .ipynb file to another folder later, and Jupyter will open it from there.

Stop Jupyter when you're done

To shut down Jupyter, go back to your terminal or Command Prompt and press Ctrl+C. You'll see a prompt asking if you want to shut down the server — type y and press Enter. The browser tab stays open but won't work anymore. To start Jupyter again, type jupyter notebook in the terminal once more.

If you plan to use Jupyter regularly, you don't need to shut it down every time. Many people leave it running in the background and straightforward close the browser tab when they're done working. The next time you open the same URL or type jupyter notebook again, your notebooks will be exactly where you left them.

Use Anaconda if pip installation doesn't work

Anaconda is an alternative installer that bundles Python, Jupyter, and dozens of data science packages together. If you had trouble with the pip method, Anaconda can be simpler because it handles all the dependencies at once. read the Anaconda installer from anaconda.com, run it, and follow the prompts. During installation, check the box to add Anaconda to your PATH.

After Anaconda installs, Jupyter is already included. Open your terminal or Command Prompt and type jupyter notebook the same way. Anaconda also includes a graphical launcher called Anaconda Navigator where you can click a button to start Jupyter instead of typing in the terminal.

Frequently Asked Questions

What's the difference between Jupyter Notebook and JupyterLab?

JupyterLab is a newer interface that looks more like a traditional code editor, with a file browser on the left and multiple tabs. Jupyter Notebook is simpler and more focused on the notebook itself. Both use the same .ipynb files. You can install JupyterLab with pip install jupyterlab and start it with jupyter lab.

Can I use Jupyter with languages other than Python?

Jupyter was built for Python, but it supports other languages through kernels — add-on packages that let Jupyter run code in R, Julia, or JavaScript. Most people use it with Python. If you want to use another language, you'll need to install the kernel separately after Jupyter is working.

Why does Jupyter say "port 8888 is already in use"?

This means another program or another Jupyter instance is using that port. You can either close the other program, or start Jupyter on a different port by typing jupyter notebook --port 8889. Jupyter will use port 8889 instead.

Can I share a Jupyter notebook with someone else?

Yes — send them the .ipynb file. They can open it in their own Jupyter installation. If they don't have Jupyter installed, they can view it on nbviewer.org by pasting the file's URL, though they won't be able to run the code without installing Jupyter themselves.

Is Jupyter safe to use offline?

Yes. Jupyter runs entirely on your computer unless you configure it otherwise. Your code and data stay local. The only internet connection involved is when you install packages with pip, which downloads them from the Python Package Index.