JupyterLab is the easiest place to experiment with AI models on your own PC: you load a model once, it stays in your graphics card's memory, and you can try different prompts or settings cell by cell. The catch is getting JupyterLab, the right GPU build of PyTorch and your project's packages into the same Python environment. This guide does that on Windows with uv, then shows how to check the GPU is working, keep projects separate with kernels and free VRAM when you're done.
What you need
Windows 10 or 11 and a PowerShell window.
An up-to-date graphics driver. uv's automatic PyTorch selection looks at the driver you have installed.
uv. If you haven't installed it yet, follow step 1 of our uv guide for local AI. You don't need to install Python separately, because uv can download it.
Prefer a desktop app instead of a browser tab, or a different notebook altogether? Our best Python notebook apps for local AI guide covers JupyterLab Desktop, VS Code and marimo.
Step 1: Make a project folder and an environment
Open PowerShell, make a folder for your experiments and create a virtual environment in it. The --seed option adds pip to the environment, which uv's Jupyter guide recommends if your notebooks use %pip install:
mkdir C:\ai-lab
cd C:\ai-lab
uv venv --seed --python 3.12
uv creates the environment in a .venv folder and will download Python 3.12 if you don't already have it. PyTorch's Get Started page says the latest stable PyTorch needs Python 3.11 or later, so 3.12 is a sensible choice, but use whatever version the project you're following asks for.
Step 2: Install a GPU build of PyTorch first
Install PyTorch before anything else, so later packages don't pull in a CPU-only build. uv's --torch-backend=auto option queries your installed CUDA driver, AMD GPU and Intel GPU, then uses the most compatible PyTorch package index:
uv pip install torch torchvision --torch-backend=auto
If you'd rather choose the build yourself, name it instead, for example --torch-backend=cu130 for a CUDA 13.0 build on an NVIDIA card. uv's PyTorch documentation lists the options, including Intel GPUs and ROCm, but notes that PyTorch doesn't publish ROCm builds for Windows. If auto-detection finds no suitable GPU, uv falls back to the CPU-only build. AMD Radeon and Intel Arc owners on Windows should follow our PyTorch ROCm on Windows and PyTorch on Intel Arc guides.
Step 3: Install JupyterLab into the same environment
uv pip install jupyterlab
Then install anything else your project needs, such as transformers or diffusers, with uv pip install. Because uv finds the .venv folder in the current directory automatically, you don't have to activate the environment first.
Step 4: Start JupyterLab
Run JupyterLab from the environment's Scripts folder:
.venv\Scripts\jupyter lab
Your browser should open at http://localhost:8888/lab. If it doesn't, copy one of the URLs printed in the PowerShell window. Jupyter Server uses token authentication by default, so the URL includes a long token; keep it to yourself. Leave the PowerShell window open while you work: that's where the server is running.
Step 5: Check that your GPU is working
Create a new notebook and run this in the first cell:
import torch
print(torch.__version__)
print(torch.cuda.is_available())
The version string normally ends with the build you got, such as +cu130 or +cpu. On an NVIDIA CUDA build, torch.cuda.is_available() should print True (Intel Arc builds use torch.xpu instead; our Arc guide covers the check). If it prints False, or the version ends in +cpu, see how to fix PyTorch CUDA not available.
Step 6: Use kernels to keep projects separate
Once you have more than one AI project, you don't need a separate JupyterLab install for each. Install ipykernel into a project's environment and register it as a kernel, run from that project's folder:
uv pip install ipykernel
.venv\Scripts\python -m ipykernel install --user --name ai-lab --display-name "Python (ai-lab)"
It then appears as a choice in JupyterLab's kernel picker when you create or open a notebook. The IPython documentation notes that registering another kernel with the same --name overwrites the old one, so give each project its own name. If your project is managed with uv init and uv add, uv's Jupyter guide shows the project-based version: add ipykernel with uv add --dev ipykernel and launch with uv run --with jupyter jupyter lab.
Step 7: Free up VRAM without closing everything
A notebook kernel keeps everything you loaded, including models on the GPU, until you delete it or restart the kernel. That's the point of a notebook, but it also means a forgotten notebook can hold several gigabytes of VRAM while you try to run something else.
Delete and clear: del model followed by torch.cuda.empty_cache(). PyTorch's documentation explains that its caching allocator keeps freed memory reserved, which still shows as used in nvidia-smi, and that empty_cache() releases unused cached memory so other GPU apps can use it. Memory still held by live tensors isn't freed.
Check usage from inside the notebook: torch.cuda.memory_allocated() shows memory used by tensors and torch.cuda.memory_reserved() shows the total held by PyTorch's allocator.
Restart the kernel: the surest way to free everything, from JupyterLab's Kernel menu.
To see which programs are using your graphics memory outside Jupyter, use our VRAM usage guide for Windows or see which apps are using the GPU with nvidia-smi.
Troubleshooting
jupyter isn't recognised: run it with the full path, .venv\Scripts\jupyter lab, from the project folder, or activate the environment first with .venv\Scripts\activate.
A package installed in a notebook can't be imported: make sure the notebook is using the right kernel. uv's Jupyter guide explains that, with a seeded environment, %pip install inside the notebook installs into that environment.
Big model downloads filling drive C:? Move the Hugging Face cache with our Hugging Face cache guide.
Never expose the server to your network unless you've read the Jupyter Server security documentation: anyone who can reach a Jupyter server can run code on your PC.