PyTorch is a freely available framework based on machine learning that is utilized to build and train a Neural Network(NN). Moreover, the data science community used it due to its flexibility. It can be installed and used on different Windows distributions depending on the user’s system needs, such as Python’s popular distribution named Anaconda which is most widely utilized in data science.
In this tutorial, we will provide the process of installing the PyTorch in Anaconda.
How to Install PyTorch in Anaconda?
To install PyTorch in Anaconda, check out the following instructions:
-
- Launch the Anaconda Prompt using the Start menu.
- Create the conda environment for PyTorch.
- Then, activate the environment using the “conda activate <env-name>” command.
- Next, execute the “conda install” command to install the latest version of PyTorch along with the required packages.
- Verify the successful installation of PyTorch by running the “conda list” command.
Step 1: Access Anaconda Prompts
First of all, search and access the “Anaconda Prompt” terminal with the help of the Start menu:
Step 2: Create Conda Environment
Then, use the provided command to create the conda environment for PyTorch:
According to the following output, a new conda environment has been created successfully:
Step 3: Activate Conda Environment
Afterward, activate the previously created environment with the help of the “conda activate” command:
Step 4: Install PyTorch
Now, execute the below-listed command to install the latest version of the PyTorch along with the “trochvision” and “torchaudio” packages:
Next, it will ask you to press “n” for no and “y” for yes to proceed with the process. We have pressed the “y” key:
After completing the installation process, you will get the output like the provided screenshot:
Step 5: Verification
Lastly, verify the installation of PyTorch by executing the “conde list” cmdlet:
That’s all! You have learned the process of installing PyTorch in Anaconda.
Conclusion
To install PyTorch in Anaconda, launch the Anaconda’s Prompt using the Start menu and generate the conda environment for PyTorch. After that, activate the environment and execute the “conda install” command to install the latest version of PyTorch along with the required packages. This guide has described the installation process of PyTorch in Anaconda.