Open In App

How To Update Pytorch Using Pip

Last Updated : 13 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

PyTorch is an open-source machine learning framework based on the Torch library. It is crucial to keep PyTorch up to date in order to use the latest features and improves bug fixing. In this article, we will learn some concepts related to updating PyTorch using pip and learn how to update PyTorch using pip step by step with example and screenshots.

We can simply update the PyTorch using Pip:

pip install --upgrade torch torchvision

Pip is a package manager for Python helps users to install Python packages. It collects and install packages from the Python Package Index (PyPI) within the system.

PyTorch is an open-source machine learning library created by Facebooks AI Research lab (FAIR) used for deep learning, neural networks and tensor calculations.

Steps to Update Pytorch Using Pip

1. Verify Current Version:

  • Open terminal or command prompt.
  • Type pip show torch and press Enter.
pip show torch 

Output:

Name: torch
Version: 2.1.0+cu121
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /usr/local/lib/python3.10/dist-packages
Requires: filelock, fsspec, jinja2, networkx, sympy, triton, typing-extensions
Required-by: fastai, torchaudio, torchdata, torchtext, torchvision

2. Run Update command:

  • Open terminal or command prompt.
  • Type pip install –upgrade torch torchvision torchaudio and press Enter.
pip install --upgrade torch torchvision torchaudio
  • Pip downloads and installs the latest compatible versions of PyTorch, Torchvision, and Torchaudio.

3. Verify Update:

  • Open terminal or command prompt
  • Type pip show torch and press Enter
!pip show torch 

Output:

Name: torch
Version: 2.2.0
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org/
Author: PyTorch Team
Author-email: packages@pytorch.org
License: BSD-3
Location: /usr/local/lib/python3.10/dist-packages
Requires: filelock, fsspec, jinja2, networkx, nvidia-cublas-cu12, nvidia-cuda-cupti-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-runtime-cu12, nvidia-cudnn-cu12, nvidia-cufft-cu12, nvidia-curand-cu12, nvidia-cusolver-cu12, nvidia-cusparse-cu12, nvidia-nccl-cu12, nvidia-nvtx-cu12, sympy, triton, typing-extensions
Required-by: fastai, torchaudio, torchdata, torchtext, torchvision


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads