Skip to content

Commit

Permalink
🚧 setting jupyter notebook tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
tommydebisi committed Nov 18, 2024
1 parent b531821 commit 22d59c8
Showing 1 changed file with 149 additions and 0 deletions.
149 changes: 149 additions & 0 deletions tutorials/en/setting-up-jupyter-notebook.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
title: "How to Set Up and Use Jupyter Notebooks Locally"
description: "An easy, step-by-step guide to setting up Jupyter Notebooks on your computer—perfect for total beginners ready to explore the world of coding!"
image: "https://imagedelivery.net/K11gkZF3xaVyYzFESMdWIQ/c70d6203-f514-4b22-086c-9bc2cfdb6d00/full"
authorUsername: "TommyA"
---

# **How to Set Up and Use Jupyter Notebooks Locally**

## **Introduction**

Hello! Tommy here, and today I’m thrilled to introduce you to the world of Jupyter Notebooks. Whether you’re a total beginner curious about coding or someone exploring how to use notebooks for data analysis, this tutorial is for you. I'll guide you through setting up Jupyter Notebook on your local computer step-by-step. No prior technical experience? No worries—I’ve got you covered with clear instructions and simple explanations.

By the end of this guide, you’ll know how to install Jupyter Notebook, start it on your computer, and create your first notebook to run Python code. Ready to unleash the power of Jupyter? Let’s dive in and make it easy and fun! 🚀

## **Step 1: Install Python**

Jupyter Notebooks run on Python, so the first thing we need to do is install Python on your computer.

1. **Download Python**:
- Go to the [official Python website](https://www.python.org/downloads/).
- Click the **Download Python** button. The website will automatically detect the right version for your operating system.
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954573/download-page_b3niom.png" alt="python downloads page" caption="Python download page" />
2. **Install Python**:
- Open the downloaded file to start the installation.
- During installation, make sure to check the box that says **“Add Python to PATH”**—this is important for everything to work properly.
- Follow the on-screen instructions to complete the installation.

Once Python is installed, you’re ready to install Jupyter Notebook.

## **Step 2: Install Jupyter Notebook**

Jupyter Notebook is a tool that comes as a Python package. We’ll install it using a tool called `pip`, which is included with Python.

1. **Open Command Prompt or Terminal**:
- On Windows, search for **Command Prompt** in the Start menu.
- On macOS/Linux, open the **Terminal** application.
2. **Install Jupyter Notebook**:

- Type the following command into Command Prompt or Terminal and press Enter:

```bash
pip install notebook
```

- Wait for a few moments while Jupyter Notebook is downloaded and installed.

Now that Jupyter is installed, let’s learn how to open it.

## **Step 3: Launch Jupyter Notebook**

We’re now ready to launch Jupyter Notebook and open its interface in your web browser.

1. **Navigate to Your Folder**:

- In Command Prompt or Terminal, type `cd` followed by the path to the folder where you want to save your work. For example:

```bash
cd Documents
```

This step tells Jupyter where to save your files.

**Start Jupyter Notebook**:

- Type this command in the terminal/command prompt and press Enter:
```bash
jupyter notebook
```
- Your default web browser will open, showing the Jupyter Notebook interface.
This is how mine looks like from the directory I entered the command:
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954572/starting-server_iahyks.png" alt="Jupyter server" caption="Jupyter server" />

If the browser doesn’t open automatically, copy the link shown in Command Prompt or Terminal and paste it into your browser.
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954573/access-server_rz14k4.png" alt="Fallback urls" caption="Jupyter fallback urls" />

## **Step 4: Create Your First Notebook**

Now that Jupyter is running, let’s create your very first notebook.

1. In the Jupyter interface, click the **“New”** button on the right side of the screen.
2. From the dropdown menu, select **“Python 3”**.
3. A new notebook will appear in the file list with the default name `Untitled.ipynb`.
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731955723/Screenshot_2024-11-16_at_11.05.47_PM_ygdxr0.png" alt="New Notebook" caption="New Notebook" />
4. To rename the file, **right-click** on `Untitled.ipynb` and select **Rename** from the menu.
5. Enter a new name for the file and ensure it ends with `.ipynb` (e.g., `MyFirstNotebook.ipynb`).
6. Double-click the renamed file to open it. You’ll be redirected to a new page where you can interact with the kernel and start coding in your notebook.

When the new tab opens, you might see a pop-up box titled **"Select Kernel"** (like the one in the image). If this happens, simply leave **Python 3** as the selected kernel and click **Select**. This ensures your notebook is ready to run Python code.
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954565/select-kernel_ceivr1.png" alt="Select kernel" caption="Select kernel" />

Let’s try running some Python code!

## **Step 5: Write and Run Your First Python Code**

Jupyter Notebooks are interactive, meaning you can write and execute code one piece at a time.

1. In the empty box (called a **“cell”**), type the following Python code:

```python
print("Hello, Jupyter!")
```

2. Press **Shift + Enter** on your keyboard to run the code.
3. You’ll see the output below the cell—“Hello, Jupyter!
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954564/print-code_wx8igu.png" alt="Print code" caption="Print code" />

## **Step 6: Save and Close Your Notebook**

Once you’re done working on your notebook, it’s essential to save your progress and close everything properly.

1. **Save Your Work**:
- To save your notebook, go to the top menu and click on **File** > **Save Notebook**. Alternatively, you can press **Command + S (macOS)** or **Ctrl + S (Windows)** to save quickly.
2. **Close the Notebook**:
- To close the notebook, go to **File** > **Close and Shut Down Notebook**. This ensures the notebook stops running in the background.
3. **Stop Jupyter Notebook**:
- After closing the notebook, go back to your Command Prompt or Terminal.
- Press **Ctrl + C** and type **Y** when prompted to confirm shutting down the Jupyter Notebook server.
<Img src="https://res.cloudinary.com/dqvd8otcz/image/upload/v1731954580/shutdown-kernel_zjsmgo.png" alt="Shutdown kernel" caption="Shutdown kernel" />

## **Conclusion**

Congratulations! You’ve successfully set up **Python** and **Jupyter Notebook** on your local computer, created your first notebook, and even wrote and ran some Python code. Along the way, you learned how to rename your notebook, select the appropriate kernel, and save your work. Jupyter Notebook is a fantastic tool that combines code, visuals, and narrative in a single interface, making it ideal for learning and experimenting.

This guide is just the beginning of what you can achieve with Jupyter. Whether you’re planning to explore data analysis, create visualizations, or dive into machine learning, Jupyter Notebook provides a beginner-friendly environment to bring your ideas to life.

Now that you’ve taken this first step, remember that the only limit is your curiosity. Keep experimenting, keep learning, and most importantly—have fun as you embark on your coding journey! 🎉

## **Next Steps?**

1. **Learn More Python**:
- Explore tutorials on Python basics to build your coding skills.
2. **Use Python Libraries**:

- Try out libraries like `numpy` for math, `pandas` for data, and `matplotlib` for charts. Install them using:

pip **install** numpy pandas matplotlib

3. **Customize Your Notebooks**:

- Add notes and descriptions in your notebooks using Markdown.

4. **Share Your Work**:

- Save and share your `.ipynb` files or upload them to platforms like GitHub.

5. **Keep Experimenting**:

- Use Jupyter Notebooks to explore data, create visualizations, or even build small projects.

0 comments on commit 22d59c8

Please sign in to comment.