You ask — we answer!

Apps & Guides

PyTorch for Linux

Modern Linux distributions are highly dependent on the installed version of Python. Therefore, before installing PyTorch, we recommend creating a virtual environment using our step-by-step guide Linux system utilities.

Activate the created venv and proceed with the pip3 upgrade:

pip3 install --upgrade pip

Start the PyTorch installation:

pip3 install torch torchvision

If you want to install a specific version of PyTorch, just type the required version number:

pip3 install torch==1.9.0 torchvision==0.10.0

When the installation is finished, let’s check that PyTorch was installed correctly. Open the Python interpreter:

python3

Type these two strings, ending your input with the Enter key:

import torch
print(torch.__version__)

If you get a result like this, it means that PyTorch has been installed correctly:

2.0.1+cu117

See also:



Updated: 14.03.2025

Published: 22.01.2025