Last active
August 29, 2025 11:55
-
-
Save alastori/72a3258a86bf1357d6a004c8202da302 to your computer and use it in GitHub Desktop.
setup_jupyter.sh — builds on [setup_venv.sh](https://gist.github.com/alastori/ed46fba72be8398e171c401761d0be9e) to install Jupyter in .venv and register a per-project kernel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Ensure the base venv script exists in your home | |
| if [ ! -x "$HOME/setup_venv.sh" ]; then | |
| echo "Error: $HOME/setup_venv.sh not found or not executable." | |
| echo "Download it or make it executable: chmod +x ~/setup_venv.sh" | |
| exit 1 | |
| fi | |
| # Run base venv setup (creates .venv in the CURRENT project dir) | |
| "$HOME/setup_venv.sh" | |
| # Activate venv in the CURRENT project dir | |
| # shellcheck disable=SC1091 | |
| source .venv/bin/activate | |
| # Install Jupyter + ipykernel (fast with uv) | |
| uv pip install --upgrade pip | |
| uv pip install jupyterlab ipykernel | |
| # Register kernel with a project-based name | |
| KERNEL_NAME="$(basename "$PWD")" | |
| python -m ipykernel install --user --name "$KERNEL_NAME" --display-name "Python ($KERNEL_NAME)" | |
| echo "Jupyter installed and kernel registered as: Python ($KERNEL_NAME)" | |
| echo "Run with: uv run jupyter lab" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment