44. Install PyTorch and First Tensors
44.1 Install PyTorch Simply
Why. Theory is done enough — time to install the library we will use for deep learning on this site: PyTorch (not Keras-first).
What. PyTorch is a popular Python library for tensors and neural nets. CPU install is enough for these beginner chapters. GPU is optional speed.
How.
Install in a venv (recommended)
- Create/activate a virtual environment.
- Install from the official command on pytorch.org for your OS (CPU build is fine).
- Or try:
pip install torchinside the venv. - Verify with a one-line import.
import torch
print(torch.__version__)
print("cuda available:", torch.cuda.is_available())
What you should see. A version string. cuda available: False is OK on many laptops — chapters still run on CPU.
Classroom note
If install fails behind a proxy, ask your trainer for the offline wheel. Do not paste random .exe files from the web.