Failed to install(update?) pytorch 0.4.0 from 0.2.0_3

Hi. I’m beginner of pytorch, and I’m trying to version up pytorch from 0.2.0_3 to 0.4.0.

Using conda environment, I tried to follow the instruction they gave(https://pytorch.org/)

I followed codes they gave, (like conda install pytorch torchvision -c pytorch)

the version never changed somehow.(installation worked, but not changed.)

I checked my version of pytorch with

python
import torch
torch.version

But they always returned 0.2.0_3

So I decided to install pytorch from the source.

But I got another error, which is

[ 96%] Linking CXX executable …/bin/broadcast_test
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/undefined_tensor_test.dir/build.make:98: recipe for target ‘bin/undefined_tensor_test’ failed
make[2]: *** [bin/undefined_tensor_test] Error 1
CMakeFiles/Makefile2:1440: recipe for target ‘caffe2/CMakeFiles/undefined_tensor_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/undefined_tensor_test.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/atest.dir/build.make:98: recipe for target ‘bin/atest’ failed
make[2]: *** [bin/atest] Error 1
CMakeFiles/Makefile2:904: recipe for target ‘caffe2/CMakeFiles/atest.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/atest.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/scalar_test.dir/build.make:98: recipe for target ‘bin/scalar_test’ failed
make[2]: *** [bin/scalar_test] Error 1
CMakeFiles/Makefile2:1058: recipe for target ‘caffe2/CMakeFiles/scalar_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/scalar_test.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/half_test.dir/build.make:98: recipe for target ‘bin/half_test’ failed
make[2]: *** [bin/half_test] Error 1
CMakeFiles/Makefile2:865: recipe for target ‘caffe2/CMakeFiles/half_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/half_test.dir/all] Error 2
[ 96%] Linking CXX executable …/bin/apply_utils_test
[ 96%] Linking CXX executable …/bin/scalar_tensor_test
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/broadcast_test.dir/build.make:98: recipe for target ‘bin/broadcast_test’ failed
make[2]: *** [bin/broadcast_test] Error 1
CMakeFiles/Makefile2:982: recipe for target ‘caffe2/CMakeFiles/broadcast_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/broadcast_test.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/apply_utils_test.dir/build.make:98: recipe for target ‘bin/apply_utils_test’ failed
make[2]: *** [bin/apply_utils_test] Error 1
CMakeFiles/Makefile2:1175: recipe for target ‘caffe2/CMakeFiles/apply_utils_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/apply_utils_test.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/scalar_tensor_test.dir/build.make:98: recipe for target ‘bin/scalar_tensor_test’ failed
make[2]: *** [bin/scalar_tensor_test] Error 1
CMakeFiles/Makefile2:1401: recipe for target ‘caffe2/CMakeFiles/scalar_tensor_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/scalar_tensor_test.dir/all] Error 2
[ 96%] Linking CXX executable …/bin/basic
[ 96%] Linking CXX executable …/bin/native_test
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/basic.dir/build.make:98: recipe for target ‘bin/basic’ failed
make[2]: *** [bin/basic] Error 1
CMakeFiles/Makefile2:943: recipe for target ‘caffe2/CMakeFiles/basic.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/basic.dir/all] Error 2
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/native_test.dir/build.make:98: recipe for target ‘bin/native_test’ failed
make[2]: *** [bin/native_test] Error 1
CMakeFiles/Makefile2:1596: recipe for target ‘caffe2/CMakeFiles/native_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/native_test.dir/all] Error 2
Scanning dependencies of target integer_divider_test
[ 96%] Linking CXX executable …/bin/integer_divider_test
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnRestoreDropoutDescriptor' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetRNNDescriptor_v6’
/home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference to cudnnSetConvolutionGroupCount' /home/yhbyun/pytorch/build/lib/libcaffe2_gpu.so: undefined reference tocudnnSetConvolutionMathType’
collect2: error: ld returned 1 exit status
caffe2/CMakeFiles/integer_divider_test.dir/build.make:94: recipe for target ‘bin/integer_divider_test’ failed
make[2]: *** [bin/integer_divider_test] Error 1
CMakeFiles/Makefile2:1635: recipe for target ‘caffe2/CMakeFiles/integer_divider_test.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/integer_divider_test.dir/all] Error 2
[ 97%] Linking CXX shared library …/…/lib/libtorch.so
[ 97%] Built target torch
Makefile:140: recipe for target ‘all’ failed
make: *** [all] Error 2
Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use-mkldnn nccl caffe2 nanopb libshm gloo THD c10d’

With googling, I found two possibilities

  1. cuda version problem -> I already got a cuda version >6 (8.0)
  2. remove onnx, and reinstall it.
    -> also failed.

What should I do to fixed that error, or how can I update pytorch version?

Thanks for your advices!

Could you try to uninstall PyTorch again.
Run the following commands until you get an error stating the lib cannot be found:

conda uninstall pytorch
pip uninstall torch
pip uninstall torch # run this command twice

Then try to reinstall it. Let me know, if that helps.

Thanks for your reply.

I tried your command. conda, pip uninstall pytorch and torch.

yhbyun@tako:~$ pip uninstall pytorch
Skipping pytorch as it is not installed.
yhbyun@tako:~$ pip uninstall torch
Skipping torch as it is not installed.

(pytorchyh2) yhbyun@tako:~/pytorch$ conda uninstall pytorch
Solving environment: failed
PackagesNotFoundError: The following packages are missing from the target environment:

Also, check if still I got any pytorch library, which is not.

(pytorchyh2) yhbyun@tako:~/pytorch$ python
Python 3.5.5 |Anaconda, Inc.| (default, May 13 2018, 21:12:35)
[GCC 7.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import torch
Traceback (most recent call last):
File “”, line 1, in
File “/home/yhbyun/pytorch/torch/init.py”, line 16, in
from .version import version
ImportError: No module named ‘torch.version’

exit()

After that, I installed pytorch again with source setup.py, but still got same error.

Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack --use-mkldnn nccl caffe2 nanopb libshm gloo THD c10d’

Are you building PyTorch from source?
If you don’t need the current master bug fixes and features, it’s simpler to install it using the pre-built binaries.
However, if you want to build from source, try to run python setup.py clean before pyhon setup.py install.

Thanks for your reply.

I already tried using python setup.py clean, but that didn’t work too.

I tried to build pytorch from source because I couldn’t update pytorch, but after I removed pytorch like you said, pre-built binaries worked.

So I don’t know why that kind of error occurs, but now I can use 0.4.0 version.

Thanks a lot.

That’s good to hear. The latest version is 0.4.1. Are you sure you’ve installed 0.4.0?
If so, you could try to update conda with: conda update -n base conda and re-install PyTorch again.

1 Like