Setting Up Python with Jupyter Notebook on Windows 11 Made Easy
System Requirements
To set up Python and Jupyter Notebook smoothly, ensure your Windows 11 is up-to-date, ideally running at least version 21H2 or later. A minimum of 4 GB of RAM is recommended for optimal performance, especially if running multiple applications alongside Jupyter Notebook.
Step 1: Install Python
-
Download Python
- Navigate to the official Python website.
- Click on the “Download Python” button, which will automatically detect your Windows version.
-
Run the Installer
- Locate the downloaded installer (typically in your Downloads folder).
- Right-click on the installer and select “Run as administrator”.
- Ensure you check the box “Add Python to PATH” before clicking on “Install Now” to simplify accessing Python from the command line.
-
Verify Python Installation
- Open Command Prompt by typing
cmdin the Start menu. - Enter
python --versionto confirm Python is installed correctly. - You should see the Python version number if the installation was successful.
- Open Command Prompt by typing
Step 2: Install pip (Python Package Installer)
Pip typically comes pre-installed with Python 3.4 and later versions. To check if pip is installed:
- Open Command Prompt and type
pip --version. - If you see a version number, pip is installed. If not, you can download the
get-pip.pyscript from the pip installation page.
Run the following command in Command Prompt:
python get-pip.py
Step 3: Install Jupyter Notebook
-
Open Command Prompt or Windows Terminal
- You can use any command line interface, but Windows Terminal provides a modern experience.
-
Install Jupyter using pip
- Run:
pip install notebook - This command downloads and installs Jupyter Notebook and its dependencies directly from the Python Package Index (PyPI).
- Run:
Step 4: Launch Jupyter Notebook
-
Open Command Prompt or Windows Terminal
- Type
jupyter notebookand press Enter.
- Type
-
Browser Launch
- Your default web browser will automatically open to the Jupyter Notebook dashboard, typically at
http://localhost:8888.
- Your default web browser will automatically open to the Jupyter Notebook dashboard, typically at
-
Troubleshooting Launch Issues
- If the page does not open, copy the terminal-generated URL (which looks like
http://localhost:8888/?token=<random_token>) and paste it into your browser.
- If the page does not open, copy the terminal-generated URL (which looks like
Step 5: Create Your First Notebook
-
Create a New Notebook
- From the Jupyter dashboard, click on “New” in the top-right corner and select “Python 3” to create a new notebook.
-
Explore the Interface
- The notebook provides a coded environment with cells for writing and executing Python code.
- You can switch between code and markdown cells using the dropdown in the toolbar.
-
Running Code in Cells
- Type your Python code in a cell and press
Shift + Enterto execute it. - Experiment with basic commands to familiarize yourself with real-time outputs.
- Type your Python code in a cell and press
Step 6: Customize Jupyter Notebook
-
Keyboard Shortcuts
- Learn essential shortcuts:
Bto add a new cell below,Ato add above,D, D(double press) to delete a cell, andMto convert a cell to markdown.
- Learn essential shortcuts:
-
Change the Theme
- Jupyter allows customization through extensions. Install
jupyterthemesfor advanced themes:pip install jupyterthemes - Apply a theme using:
jt -t <theme_name>
- Jupyter allows customization through extensions. Install
Step 7: Installing Additional Libraries
To extend Jupyter’s capabilities, you may want to install additional libraries such as numpy, pandas, or matplotlib:
pip install numpy pandas matplotlib
After installation, import these libraries in your Jupyter Notebook:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
Step 8: Save and Share Your Work
-
Saving Your Notebook
- Click on “File” > “Save and Checkpoint” to save your progress, or simply hit
Ctrl + S.
- Click on “File” > “Save and Checkpoint” to save your progress, or simply hit
-
Exporting Notebooks
- To share your work, select “File” > “Download as” to export your notebook in different formats like HTML, Markdown, or PDF.
Step 9: Close Jupyter Notebook
-
Stopping the Server
- Return to Command Prompt or Windows Terminal and terminate the server by pressing
Ctrl + Ctwice.
- Return to Command Prompt or Windows Terminal and terminate the server by pressing
-
Shut Down the Browser Tab
- You can close the browser tab directly after stopping the server.
Step 10: Keeping Everything Updated
Regular updates help maintain functionality:
-
Update pip regularly:
pip install --upgrade pip -
Update Jupyter Notebook and libraries:
pip install --upgrade notebook
Additional Tools and Alternatives
-
Anaconda Distribution
- For users preferring an all-in-one approach, download Anaconda. It comes pre-installed with Jupyter and many scientific libraries.
-
VS Code Integration
- Use Visual Studio Code for a more feature-rich experience. Install the Jupyter extension for interactive notebooks directly within the IDE.
Final Touches
Configuring Python and Jupyter Notebook on Windows 11 enhances your data science projects without hassle. The platform’s flexibility allows for seamless integration with numerous packages, enabling you to create powerful data analysis tools. Whether you’re a beginner or an experienced programmer, following these steps will ensure a smooth setup of your Python environment on Jupyter Notebook in no time.