pytorch

How to Upgrade PyTorch

The tech giant Meta released the current version of PyTorch in May 2023. It built on the years of progress in the popular development framework ever since its inception in 2016. Data Scientists and programmers both are always looking to upgrade to the latest release to avail all the new features and make the most out of its capabilities in the field of machine learning models.

In this article, the focus will be on how to upgrade PyTorch to the latest available version.

How to Upgrade PyTorch?

Upgrading the PyTorch framework to the latest version is always the recommended course of action because the newer release comes with bug fixes and new features.

Follow the steps given below to upgrade PyTorch within the Anaconda IDE:

Step 1: Launch the Anaconda Prompt

Go over to the Windows “Start Menu” and type in “Anaconda Prompt” and then, click on it:


Step 2: Install PyTorch in Anaconda IDE

In the command below, the “-c” method is used to specify additional channels to check for the PyTorch package. Use the following command in the Anaconda Prompt to install the PyTorch package:

conda install -c pytorch-lts pytorch

 
This will install PyTorch as seen in the screenshots below:


 

Step 3: Check Installed Version

Following the installation, the version of PyTorch that was just installed in the Anaconda IDE needs to be checked. The “-f” command is used to search for the full name of PyTorch. This can be done by printing the information about the PyTorch package as shown below:

conda list -f pytorch

 
The upgraded version of PyTorch is displayed in the output:

Pro-Tip

It is important to regularly upgrade PyTorch to the latest version so that users can use the new features. Moreover, using the same version as fellow developers is critical to avoid any complications due to code incompatibility.

Success! You have just learned how to upgrade PyTorch in Conda.

Conclusion

To upgrade PyTorch in Conda, utilize the “conda install -c pytorch-lts pytorch” command. Then, check the installed version by using “conda list -f pytorch” command to print the PyTorch package specifications. It will show the version of PyTorch and its build channel as seen in the last screenshot above. This is how to upgrade PyTorch in the Anaconda IDE in Windows.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.