Set up PyTorch on Linux





[1] Setup Virtual Environments with Anaconda

Test environments :
(1) Python : 3.7
(2) PyTorch : 1.3.0
(3) CUDA : none

$ conda create -n pytorch_test_env1 python=3.7

You can run the created environments by,

$ conda activate pytorch_test_env1

Now you can download torchvision by,

$ pip install torch==1.3.0+cpu torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.htm

The reason for not using a GPU is that installing CUDA is quite complicated for individual computer environment.
In this tutorial, we are only going to focus ‘neural networks’, so I skipped installing CUDA.

You can also download numpy, matplotlib and scikit-learn

$ pip install numpy matplotlib scikit-learn





[2] Check PyTorch

You can check installation success by importing PyTorch in python

$ python
$ import torch