Installing PyTorch 1.0 (Stable) with CUDA 10.0 on Windows 10 using Anaconda

PyTorch Anaconda Windows 10

PyTorch Anaconda Windows 10

Previous article: How to install PyTorch on Windows 10 using Anaconda

This is a quick update to my previous installation article to reflect the newly released PyTorch 1.0 Stable and CUDA 10.

Step 1: Install NVIDIA CUDA 10.0 (Optional)

CUDA 10 Toolkit Download
CUDA 10 Toolkit Download

This is an optional step if you have a NVIDIA GeForce, Quadro or Tesla video card.  Download the NVIDIA CUDA 10.0 Toolkit from the link below and install it. You can choose the network or local installer depending on your preference.

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exenetworkhttps://developer.nvidia.com/cuda-92-download-archive?target_os=Windows&target_arch=x86_64&target_version=10

Step 2: Install Anaconda with Python 3.7

Anaconda with Python 3.7
Anaconda with Python 3.7

Anaconda is a great development environment that is supported across MacOS, Windows and Linux. I highly recommend this program. It makes it easy to install several Python code editors and PyTorch.  My preferred editor is Spyder but Jupiter Notebook is also very popular and is used in a lot of the PyTorch challenge coursework. Download the file from the link below and install.

https://www.anaconda.com/download/#windows

Additionally here are some Windows installation instructions from Anaconda if you run into any trouble.

https://docs.anaconda.com/anaconda/install/windows/

Step 3: Install PyTorch from the Anaconda Terminal

Anaconda Prompt
Anaconda Prompt

Go to the Start Menu > Applications > Anaconda and open the Anaconda Prompt. Here you will run the following command to install PyTorch:

conda install pytorch torchvision cuda100 -c pytorch

If you didn’t install CUDA and plan to run your code on CPU only, use this command instead:

conda install pytorch-cpu torchvision-cpu -c pytorch

Lastly I recommend updating all the modules and dependancies in Anaconda using the following command:

conda update --all

Press “Y” to start the update. It will take a few minutes to finish.

Step 4: Install Intel MKL (Optional)

If you have an Intel CPU, there are libraries you can install that speed up math processing routines. It’s best to install this after updating conda since the packages are specialized and can be older than the normal packages.

conda install -c anaconda mkl

Step 5: Choose your IDE

Anaconda Navigator
Anaconda Navigator

Now load Anaconda and choose either Spyder or Jupiter Notebook. You can also check for updates by clicking the gear icon in the upper right hand corner of the application. If you have any issues or find any problems, feel free to leave a comment and I’ll update the post. Thanks and happy programming!

2 thoughts on “Installing PyTorch 1.0 (Stable) with CUDA 10.0 on Windows 10 using Anaconda

  1. Hi David,

    I followed the steps but when I run following –

    import torch
    torch.cuda.is_avialable()

    it returns False

    However, torch.backends.cudnn.enabled returns True

    Any ideas on what could have been causing this?

    Thanks,
    J

    1. Hi J,

      What video card are you using? I believe CUDA only works on certain NVIDIA cards. You can go to this site to find out more:

      https://developer.nvidia.com/cuda-gpus

      I don’t normally use torch.backends.cudnn.enabled to check CUDA status so I can’t comment on that from my experience unfortunately. Installing CUDA is also optional, even without it, you can use CUDA as long as you install the the correct PyTorch version:

      conda install pytorch torchvision cuda100 -c pytorch

      OR

      conda install pytorch torchvision cudatoolkit=10.0 -c pytorch

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.