Could NOT find CUDA when installing cutorch

3,221 views
Skip to first unread message

Vietanh Hosy

unread,
Feb 17, 2016, 12:33:41 PM2/17/16
to torch7

Hi,

I encounter this problem when trying to install Cutorch using command: 

luarocks install cutorch

CMake Error at /usr/local/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find CUDA: Found unsuitable version "5.0", but required is at
  least "5.5" (found /usr)
Call Stack (most recent call first):
  /usr/local/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:372 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/share/cmake-3.2/Modules/FindCUDA.cmake:855 (find_package_handle_standard_args)
  CMakeLists.txt:7 (FIND_PACKAGE)

I'm sure that there is no Cuda version in /usr and /usr/local/cuda links to cuda-7.0. I could not find any possible cause of this problem, hence I don't know how to solve it.


I even manually edit the FindCUDA.cmake file, to specify CUDA_TOOLKIT_ROOT_DIR before trying to find:

 855 set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-7.0)

 856 message(${CUDA_TOOLKIT_ROOT_DIR})

 857 find_package_handle_standard_args(CUDA

 858   REQUIRED_VARS 

 859     CUDA_TOOLKIT_ROOT_DIR 

 860     CUDA_NVCC_EXECUTABLE

 861     CUDA_INCLUDE_DIRS

 862     CUDA_CUDART_LIBRARY

 863   VERSION_VAR             

 864     CUDA_VERSION                                                                                

 865   )


And now comes the error message:


CMake Error at /usr/local/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):

  Could NOT find CUDA: Found unsuitable version "5.0", but required is at

  least "5.5" (found /usr/local/cuda-7.0)


I don't know what happened with cutorch/CMake and I cannot make things work.

Please advice. Many thanks.

alban desmaison

unread,
Feb 18, 2016, 5:09:02 AM2/18/16
to torch7
What does "/usr/local/cuda/bin/nvcc --version" gives you?

Vietanh Hosy

unread,
Feb 18, 2016, 5:21:15 AM2/18/16
to torch7 on behalf of alban desmaison
Hi,

It's 7.0

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Feb_16_22:59:02_CST_2015
Cuda compilation tools, release 7.0, V7.0.27

I doubt it could be some problem with CMake :(

--
You received this message because you are subscribed to a topic in the Google Groups "torch7" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/torch7/QkRk8eKAJLw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to torch7+un...@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at https://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.

alban desmaison

unread,
Feb 18, 2016, 5:52:40 AM2/18/16
to torch7
If I am not mistaken, we use the builtin cmake cuda detection here https://github.com/torch/cutorch/blob/master/CMakeLists.txt#L7

Make sure that you do not have a CMAKE_LIBRARY_PATH pointing to an older version of CUDA.
The simplest would be to make sure that you removed all other version of cuda on your computer :)

On Thursday, February 18, 2016 at 10:21:15 AM UTC, Vietanh Hosy wrote:
Hi,

It's 7.0

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Feb_16_22:59:02_CST_2015
Cuda compilation tools, release 7.0, V7.0.27

I doubt it could be some problem with CMake :(

Vietanh Hosy

unread,
Feb 18, 2016, 2:13:14 PM2/18/16
to torch7
Hi,

I have found the problem. Somehow there is a /usr/bin/nvcc file that is of Cuda 5.0. It seems that CMake tries to find from that folder before going to CUDA_TOOLKIT_ROOT_DIRS.

Simply removing this file solves the problem.
Thanks.

Michael Xiongfei Wei

unread,
Apr 12, 2016, 10:53:09 PM4/12/16
to torch7
I removed the nvcc file in /usr/bin but I got another error:








Installing https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec...


Using https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec... switching to 'build' mode


Cloning into 'cutorch'...


remote: Counting objects: 107, done.


remote: Compressing objects: 100% (103/103), done.


remote: Total 107 (delta 8), reused 44 (delta 2), pack-reused 0


Receiving objects: 100% (107/107), 157.40 KiB | 0 bytes/s, done.


Resolving deltas: 100% (8/8), done.


Checking connectivity... done.


cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/ubuntu/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/ubuntu/torch/install/lib/luarocks/rocks/cutorch/scm-1" && make -j$(getconf _NPROCESSORS_ONLN) install




-- The C compiler identification is GNU 4.8.4


-- The CXX compiler identification is GNU 4.8.4


-- Check for working C compiler: /usr/bin/cc


-- Check for working C compiler: /usr/bin/cc -- works


-- Detecting C compiler ABI info


-- Detecting C compiler ABI info - done


-- Check for working CXX compiler: /usr/bin/c++


-- Check for working CXX compiler: /usr/bin/c++ -- works


-- Detecting CXX compiler ABI info


-- Detecting CXX compiler ABI info - done


-- Found Torch7 in /home/ubuntu/torch/install


CMake Error at /usr/share/cmake-2.8/Modules/FindCUDA.cmake:548 (message):


  Specify CUDA_TOOLKIT_ROOT_DIR


Call Stack (most recent call first):


  CMakeLists.txt:7 (FIND_PACKAGE)






-- Configuring incomplete, errors occurred!


See also "/tmp/luarocks_cutorch-scm-1-153/cutorch/build/CMakeFiles/CMakeOutput.log".




Error: Build error: Failed building.

Michael Xiongfei Wei

unread,
Apr 12, 2016, 10:53:28 PM4/12/16
to torch7

shaoguang guo

unread,
May 25, 2016, 1:56:08 AM5/25/16
to torch7
Hi,
I think he best solutions is not to remove the link file , especilly when you just a comman user.
Just add an option when compile
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-6.0
no matter what 'nvcc --version' output.

This is the method when I try to install software on a supercomputer, which I have no root privilege.

Hope to help.


在 2016年2月19日星期五 UTC+8上午3:13:14,Vietanh Hosy写道:

John Pertoft

unread,
Aug 3, 2016, 11:31:35 AM8/3/16
to torch7
I'm getting similar problems. 

I have cuda7.5 installed at /usr/local/cuda-7.5 and /usr/local/cuda is a symlink to it.

nvcc --version says 7.5

I have removed the /usr/bin/nvcc (which did say version 5.5).

What else can I try?

Error message:

Warning: unmatched variable LUALIB
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find CUDA: Found unsuitable version "5.5", but required is at
  least "6.5" (found /usr)
Call Stack (most recent call first):
  /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:372 (_FPHSA_FAILURE_MESSAGE)
  /home/john/torch/install/share/cmake/torch/FindCUDA.cmake:1009 (find_package_handle_standard_args)
  CMakeLists.txt:7 (FIND_PACKAGE)



Error: Build error: Failed building.

Vietanh Hosy

unread,
Aug 3, 2016, 11:56:59 AM8/3/16
to torch7 on behalf of John Pertoft
Hi John,

I think there is nvcc 5.5 somewhere. You can search for all the nvcc file in your system, then check the version of each file and try changing name, etc.

I can only suggest that approach.

John Pertoft

unread,
Aug 3, 2016, 1:28:55 PM8/3/16
to torch7
Thanks for a quick reply!

I searched for all instances of nvcc on the system and found another of version 5.5 in /usr/lib/nvidia-cuda-toolkit/bin which I renamed temporarily. I have root access but other people are using the computer as well so I didn't want to remove it in case someone uses it. I still got the same error when installing though.

Is there any environment variable that causes this problem or circumvents it?

John Pertoft

unread,
Aug 4, 2016, 5:17:33 AM8/4/16
to torch7
Solved it by bypassing the FindCUDA.cmake script and just hardcoding all the CUDA variables instead.

hope yao

unread,
Aug 5, 2016, 5:59:59 PM8/5/16
to torch7
Hi John,

I also encountered the problem as you and still I'm stuck here. 
1. I deleted /usr/bin/nvcc
2. I tried to rename all NVCC file I found in my computer.
3. I also tried to add SET(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda") in the FindCUDA.cmake file, but it seems that this file will be overwrite in runing install.sh
But non of them worked.

I'm trying to follow your solution, but I don't quite understand how to "bypassing the FindCUDA". Could you please give me more detailed information how you solved this? Your kind help would be highly appreciated.

hope yao

unread,
Aug 7, 2016, 4:55:25 PM8/7/16
to torch7
Okay. Now I solved it. There are two FindCUDA.cmake. That line needs to be added to torch/cmake/3.6/Modules/FindCUDA.cmake. The other file is copied from this one.

ty Du

unread,
Nov 9, 2017, 8:59:17 AM11/9/17
to torch7
Hi yao,

Could you please specify where to add SET(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda") in FindCUDA.cmake? I'm new to cmake and torch. I'm also suffering from the ' Could NOT find CUDA' problem.
Thanks a lot!

在 2016年8月8日星期一 UTC+8上午4:55:25,hope yao写道:
Reply all
Reply to author
Forward
0 new messages