简体   繁体   English

在Ubuntu 16.04上安装CUDA(未满足的依赖项)

[英]Installing CUDA on Ubuntu 16.04 (unmet dependencies)

I am a newbie to Ubuntu and am trying to install CUDA on it. 我是Ubuntu的新手,正在尝试在其上安装CUDA。 I just couldn't do it. 我只是做不到。

I install Nvidia R390 driver (which is quite a hassel). 我安装了Nvidia R390驱动程序(相当麻烦)。

Then I followed the instruction at: 然后,我按照以下说明进行操作:

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

when I hit sudo apt-get install cuda 当我打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: 所以我使用sudo apt-get -f install,但是发生以下错误:

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) 然后停止X显示管理器(ubuntu默认使用lightdm)

     sudo service lightdm stop 
  • INSTALL DISPLAY DRIVER (recommended) AND CUDA TOOLKIT 安装显示驱动程序(推荐)和CUDA工具包

     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 ) POST-INSTALL(将这些行添加到.bashrc文件的末尾)

     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) CUDNN安装(可选)

    get the CUDNN stuff from HERE 这里获取CUDNN的内容

     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. 只要记住要检查要安装的tensorflow版本支持哪个cuda和cudnn版本即可。 ( for example cuda9.0, cudnn7 for tensorflow 1.7 which is the latest version when i write this answer) (例如,当我编写此答案时,tensorflow 1.7的cuda9.0,cudnn7是最新版本)

I haven't replicated the problem but your trace suggests that the /boot partition is running out of space. 我没有复制问题,但是您的跟踪显示/ boot分区空间不足。 Try clearing some old kernels, then re-run the command. 尝试清除一些旧内核,然后重新运行该命令。 Your installation should resume normally. 您的安装应恢复正常。 I hope that helps :) 希望对您有所帮助:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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