So I’ve been watching Andrej Karpathy’s videos and he makes good use of Jupyter Notebook and PyTorch.

I decided to make a post on how to install both of these in a Python environment. To start off we make said environment. python -m venv env

Then just adtivate it and install everything.

source env/bin/activate
pip install --upgrade pip
pip install --upgrade ipython jupyter
pip install --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

You can get the commands from the Jupyter Lab website and PyTorch website, respectively. I added the –upgrade to future-proof it.

Now just make a bash script to run it.

#!/bin/bash
source env/bin/activate
jupyter notebook

And it’s ready to use. Do make sure that you are editing .ipynb files or you’ll get a basic text-editor, it happened to me when editing a .py file.

Note that this is folder-specific so don’t rename it.