简体   繁体   中英

Installing CUDA on Ubuntu 16.04 (unmet dependencies)

I am a newbie to Ubuntu and am trying to install CUDA on it. I just couldn't do it.

I install Nvidia R390 driver (which is quite a hassel).

Then I followed the instruction at:

http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

when I hit sudo apt-get install cuda

following errors pop up:

     Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these.
    The following packages have unmet dependencies:
     cuda-cublas-dev-9-1 : Depends: cuda-cublas-9-1 (>= 9.1.85.3) but it is not installed
     cuda-cufft-dev-9-1 : Depends: cuda-cufft-9-1 (>= 9.1.85) but it is not installed
     cuda-curand-dev-9-1 : Depends: cuda-curand-9-1 (>= 9.1.85) but it is not installed
     cuda-cusolver-dev-9-1 : Depends: cuda-cusolver-9-1 (>= 9.1.85) but it is not installed
     cuda-cusparse-dev-9-1 : Depends: cuda-cusparse-9-1 (>= 9.1.85) but it is not installed
     cuda-libraries-9-1 : Depends: cuda-nvrtc-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-nvgraph-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-cusolver-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-cublas-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-cufft-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-curand-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-cusparse-9-1 (>= 9.1.85) but it is not installed
                          Depends: cuda-npp-9-1 (>= 9.1.85) but it is not installed
     cuda-npp-dev-9-1 : Depends: cuda-npp-9-1 (>= 9.1.85) but it is not installed
     cuda-nvgraph-dev-9-1 : Depends: cuda-nvgraph-9-1 (>= 9.1.85) but it is not installed
     cuda-nvrtc-dev-9-1 : Depends: cuda-nvrtc-9-1 (>= 9.1.85) but it is not installed
     cuda-toolkit-9-1 : Depends: cuda-nvml-dev-9-1 (>= 9.1.85) but it is not installed
     cuda-visual-tools-9-1 : Depends: cuda-nvml-dev-9-1 but it is not installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So I use sudo apt-get -f install, but following errors occurred:

Preparing to unpack .../cuda-nvrtc-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-nvrtc-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-nvrtc-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
Preparing to unpack .../cuda-cusolver-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-cusolver-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-cusolver-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
Preparing to unpack .../cuda-cublas-9-1_9.1.85.3-1_amd64.deb ...
Unpacking cuda-cublas-9-1 (9.1.85.3-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-cublas-9-1_9.1.85.3-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
Preparing to unpack .../cuda-cufft-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-cufft-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-cufft-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../cuda-curand-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-curand-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-curand-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../cuda-cusparse-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-cusparse-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-cusparse-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../cuda-npp-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-npp-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-npp-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../cuda-nvml-dev-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-nvml-dev-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-nvml-dev-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Preparing to unpack .../cuda-nvgraph-9-1_9.1.85-1_amd64.deb ...
Unpacking cuda-nvgraph-9-1 (9.1.85-1) ...
dpkg: error processing archive /var/cache/apt/archives/cuda-nvgraph-9-1_9.1.85-1_amd64.deb (--unpack):
 trying to overwrite '/usr/local/cuda-9.1/lib64', which is also in package cuda-cudart-9-1 9.1.85-1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 /var/cache/apt/archives/cuda-nvrtc-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-cusolver-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-cublas-9-1_9.1.85.3-1_amd64.deb
 /var/cache/apt/archives/cuda-cufft-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-curand-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-cusparse-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-npp-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-nvml-dev-9-1_9.1.85-1_amd64.deb
 /var/cache/apt/archives/cuda-nvgraph-9-1_9.1.85-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can someone help? I am running out of ideas. Thanks!

  • download the latest version from here
  • then stop you X display manager (lightdm is default for ubuntu)

     sudo service lightdm stop 
  • INSTALL DISPLAY DRIVER (recommended) AND CUDA TOOLKIT

     sudo chmod +x cuda_9.0_linux.run sudo ./cuda_9.0_linux.run 
  • POST-INSTALL ( add these lines to the end of your .bashrc file )

     export CUDA_HOME=/usr/local/cuda-9.0 export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH PATH=${CUDA_HOME}/bin:${PATH} export PATH 
  • CUDNN INSTALL(optional)

    get the CUDNN stuff from HERE

     tar -xzvf cudnn-XYtgz cd cudnn-XY/cuda sudo cp -r * /usr/local/cuda-9.0 sudo ldconfig 

    just remember to check which versions of cuda and cudnn are supporterd by the tensorflow version you are going to install. ( for example cuda9.0, cudnn7 for tensorflow 1.7 which is the latest version when i write this answer)

I haven't replicated the problem but your trace suggests that the /boot partition is running out of space. Try clearing some old kernels, then re-run the command. Your installation should resume normally. I hope that helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM