One Line Command to Launch a Notebook with Pytorch
uv is changing how accessible Python is for new users.
If you want to try out PyTorch in a Jupyter Notebook, you can install uv and then run this single line command:
uv run --no-project --python 3.12 --with torch --with jupyter jupyter labuv downloads Python 3.12 if needed, installs PyTorch and Jupyter in a cached environment, and launches JupyterLab. --no-project keeps the command independent of a project in the current directory.
This command uses the platform’s default PyTorch wheel and does not detect or verify a GPU. For a specific CUDA, ROCm, or CPU-only build, follow How to Install PyTorch with uv and launch Jupyter from that configured environment.
Learn More
- How to install PyTorch with uv for production setups with GPU support detection and version management
- Set up a GPU data science project with pixi for a conda-forge approach to managing CUDA and scientific libraries
- uv: A Complete Guide for the full range of uv workflows and features
Last updated on