Pytorch 0.5.0a0 + cuda 9.2 links against cuda 8.0

I installed pytorch 0.5 using the following the official guide.
My system has cuda 9.2 installed and it is included into my bash env by setting
LD_LIBRARY_PATH and PATH like described in the CUDA installation guide from nvidia.

NOTE: I upgraded from CUDA 8.0 to CUDA 9.2. The files of CUDA 8.0 are not deleted but
my bash env does not export any of CUDA 8.0 related directories:

(pyt_gh) chofer@eisbaer:~$ env | grep cuda

However, after compilation I get an import error:

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/scratch2/chofer/opt/anaconda3/envs/pyt_gh/lib/python3.6/site-packages/torch/", line 78, in <module>
    from torch._C import *
ImportError: cannot open shared object file: No such file or directory

Adding /usr/local/cuda-8.0/lib64 to LD_LIBRARY_PATH resolves the problems.

**It seems to me that pytorch 0.5 links against two CUDA versions, i.e., 8.0 + 9.2, is this a bug? **
(It would mean that one has to have installed both versions in order for pytorch to run)
Is this just happening because the cuda 8.0 directories are not deleted?

May be related to

My Modification of the installation routine:

  • I installed into a virtual env created by conda (env_name = pyt_gh)
  • changed: export CMAKE_PREFIX_PATH="/scratch2/chofer/opt/anaconda3/envs/pyt_gh/"
  • changed: conda install -c pytorch magma-cuda91