How do I install Pytorch 1.3.1 with CUDA enabled
I have a conda environment on my Ubuntu 16.04 system.

When I install Pytorch using:

conda install pytorch


and I try and run the script I need, I get the error message:

raise AssertionError("Torch not compiled with CUDA enabled")


From looking at forums, I see that this is because I have installed Pytorch without CUDA support.

I then tried:

conda install -c pytorch torchvision cudatoolkit=10.1 pytorch


but now I get the error:

    from torch.utils.cpp_extension import BuildExtension, CUDAExtension
  File "/home/username/miniconda3/envs/super_resolution/lib/python3.6/site-packages/torch/__init__.py", line 81, in &lt;module&gt;
    from torch._C import *
ImportError: /lib64/libc.so.6: version `GLIBC_2.14' not found


So it seems that these two installs are installing different versions of Pytorch(?). The first one that seemed to work was Pytorch 1.3.1.

My question: How do I install Pytorch with CUDA enabled, but ensure it is version 1.3.1 so that it works with my system?

Given that your system is running Ubuntu 16.04, it comes with glibc installed. You can check your version by typing ldd --version.
Keep in mind that PyTorch is compiled on CentOS which runs glibc version 2.17.
Then check the CUDA version installed on your system nvcc --version
Then install PyTorch as follows e.g. if your cuda version is 9.2:
conda install pytorch torchvision cudatoolkit=9.2 -c pytorch
If you get the glibc version error, try installing an earlier version of PyTorch.
If neither of the above options work, then try installing PyTorch from sources.
If you would like to set a specific PyTorch version to install, please set it as &lt;version_nr&gt; in the below command:
conda install pytorch=&lt;version_nr&gt; torchvision cudatoolkit=9.2 -c pytorch
