This guide provides step-by-step instructions for setting up Jupyter on Windows, including installing extensions and configuring different kernels for various projects.
First, create a Python virtual environment with the following command:
python -m venv kernel_2024_03_22
Activate the virtual environment in Windows using:
.\kernel_2024_03_22\Scripts\activate
To add your virtual environment to the Jupyter kernel, follow these steps:
If you need to remove a kernel, follow these instructions:
- Reference: Remove the Kernel on a Jupyter Notebook
Modify the default terminal as follows:
-
Reference: How to Change Jupyter Notebook Windows Shell to Bash
c.ServerApp.terminado_settings = { 'shell_command': [r'C:\Program Files\Git\bin\bash.exe'] }
Configure Jupyter Notebook to run on startup by following these steps:
- Press
Windows
+R
. - Type
taskschd.msc
and press Enter. - Click on
Task Scheduler Library
. - Click
Create Task
. - Set the name and configure triggers to "At log on" for your user.
- Set actions to execute
start_jupyter.bat
.
The start_jupyter.bat
file contains:
@echo off
cd D:\OneDrive\Projects\virtualenvs\kernel_2024_03_22
call D:\OneDrive\Projects\virtualenvs\kernel_2024_03_22\Scripts\activate
jupyter notebook
Specify a custom location for the Jupyter config file using an environment variable:
- Env variable:
JUPYTER_CONFIG_DIR
- Path:
D:\OneDrive\Projects\virtualenvs
This command exports the environment variable JUPYTER_CONFIG_DIR
with the specified path.
setx JUPYTER_CONFIG_DIR D:\OneDrive\Projects\virtualenvs