cuda install error on Ubuntu 17.04

13,064

Solution 1

I have successfully installed CUDA 8.0 + the latest patch from NVIDIA on Ubuntu 17.04:

  1. Download the .run file from https://developer.nvidia.com/cuda-downloads, choosing Ubuntu 16.04 (Base Installer)
  2. You will not be able to install it by just running, because it is looking for a file called InstallUtils.pm which is not present in Ubuntu 17.04, but curiously, is present in the .run file - so: unpack the .run file using ./cuda*.run --tar mxvf
  3. copy InstallUtils.pm (should be in the /bin path) to /usr/lib/x86_64-linux-gnu/perl-base
  4. Run the installer (You may want to say no to the driver install step to keep the one you install through apt - I'm using 381.22, because 375.26, which is provided by the .run file does not support my 1080ti)
  5. gcc 6 is incompatible with CUDA, but this is easily remedied for compiling the sample files: just add export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98" to your bashrc file, and comment out

from one of the headers (I think it was host_config.h, but you'll see it once you try to compile) - comment out these lines:

#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 3)
     #error -- unsupported GNU version! gcc versions later than 5.3 are not supported!

This is all from memory, so hopefully it's accurate enough.

I managed to find this solution thanks to these useful posts:

https://devtalk.nvidia.com/default/topic/983777/can-t-locate-installutils-pm-in-inc/

https://devtalk.nvidia.com/default/topic/949770/cuda-8-0rc-supporting-gcc6-/

Solution 2

https://launchpad.net/ubuntu/zesty/amd64/nvidia-cuda-toolkit

above is the correct one.

apt-get install nvidia-cuda-toolkit

but remember the cuda installed through apt were installed in different location. manually create ln -s at /usr/local/cuda for include,lib64,and bin

Solution 3

For ubuntu 17.04, I had to use cuda 9.0 (deb version) https://developer.nvidia.com/cuda-release-candidate-download

I couldn't get it to work otherwise. Cuda 8.0 needs gcc 5.3.1 but cuda 9.0 is compatible with gcc 6.3.0 which is installed on ubuntu 17.04 automatically.

Solution 4

More precisely, this is what I did:

On Ubuntu 17.04, install CUDA 9.0 — you can currently download the beta version  https://developer.nvidia.com/cuda-release-candidate-download

I downloaded the .deb file and haven’t had any problems — follow the steps they recommend when you download cuda 9.0 

sudo dpkg -i cuda-repo-ubuntu1704-9-0-local-rc_9.0.103-1_amd64.deb

sudo apt-key add /var/cuda-repo-9.0-local-rc/7fa2af80.pub

sudo apt-get update

sudo apt-get install cuda

Then follow the post installation steps from the nvidia instructions (i.e., setting PATH and LD_LIBRARY_PATH)   http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions)

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Cuda 9 is compatible with gcc 6.3.0 (which comes with 17.04). I used arch=sm_52 and sometimes for my make files have to go ‘make clean’.

Share:
13,064
user697911
Author by

user697911

Updated on June 28, 2022

Comments

  • user697911
    user697911 almost 2 years
       abigail@abilina:~/Downloads$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
    Selecting previously unselected package cuda-repo-ubuntu1604.
    (Reading database ... 205999 files and directories currently installed.)
    Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
    Unpacking cuda-repo-ubuntu1604 (8.0.61-1) ...
    Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...
    Warning: The postinst maintainerscript of the package cuda-repo-ubuntu1604
    Warning: seems to use apt-key (provided by apt) without depending on gnupg or gnupg2.
    Warning: This will BREAK in the future and should be fixed by the package maintainer(s).
    Note: Check first if apt-key functionality is needed at all - it probably isn't!
    Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package cuda-repo-ubuntu1604)
    OK
    
    abigail@abilina:~/Downloads$ sudo apt-get install cuda
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     cuda : Depends: cuda-8-0 (>= 8.0.61) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    My ubuntu version is 17.04. Does this mean my Linux currently can't install CUDA? I want to install TensorFlow with GPU support.

    Per suggestion:

    abigail@abilina:~/Downloads$ sudo apt-get -f install
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.