Ubuntu 17.04上的cuda安装错误

时间:2017-04-30 05:04:13

标签: tensorflow cuda

   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.

我的ubuntu版本是17.04。这是否意味着我的Linux目前无法安装CUDA?我想安装支持GPU的TensorFlow。

根据建议:

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.

5 个答案:

答案 0 :(得分:3)

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

以上是正确的。

apt-get install nvidia-cuda-toolkit

但请记住通过apt安装的cuda安装在不同的位置。在ln -s/usr/local/cudaincludelib64

bin手动创建{{1}}

答案 1 :(得分:3)

我已经在Ubuntu 17.04上成功安装了CUDA 8.0 + NVIDIA的最新补丁:

  1. https://developer.nvidia.com/cuda-downloads下载.run文件,选择Ubuntu 16.04(Base Installer)
  2. 你将无法通过运行来安装它,因为它正在寻找一个名为InstallUtils.pm的文件,这个文件在Ubuntu 17.04中不存在,但奇怪的是,它存在于.run文件中 - 所以:解压缩。使用./cuda*.run --tar mxvf
  3. 运行文件
  4. 将InstallUtils.pm(应该在/ bin路径中)复制到/ usr / lib / x86_64-linux-gnu / perl-base
  5. 运行安装程序(你可能想对驱动程序安装步骤说不,以保持你通过apt安装的那个 - 我使用的是381.22,因为.run文件提供的375.26不支持我的1080ti)
  6. gcc 6与CUDA不兼容,但是编译示例文件很容易解决:只需将export EXTRA_NVCCFLAGS="-Xcompiler -std=c++98"添加到您的bashrc文件中,然后注释掉
  7. 来自其中一个标题(我认为它是host_config.h,但是一旦你尝试编译就会看到它) - 注释掉这些行:

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

    这完全来自记忆,所以希望它足够准确。

    由于这些有用的帖子,我设法找到了这个解决方案:

    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-/

答案 2 :(得分:1)

对于ubuntu 17.04,我不得不使用cuda 9.0(deb版本) https://developer.nvidia.com/cuda-release-candidate-download

否则我无法让它工作。 Cuda 8.0需要gcc 5.3.1但cuda 9.0与gcc 6.3.0兼容,后者自动安装在ubuntu 17.04上。

答案 3 :(得分:1)

更确切地说,这就是我所做的:

在Ubuntu 17.04上,安装CUDA 9.0 - 您目前可以下载测试版 https://developer.nvidia.com/cuda-release-candidate-download

我下载了.deb文件并且没有任何问题 - 按照他们下载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

然后按照nvidia说明中的安装后步骤(即设置PATH和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与gcc 6.3.0(17.04附带)兼容。我使用arch = sm_52,有时候我的make文件必须'make clean'。

答案 4 :(得分:0)

在我的案例中,安装Cuda 9.0是最简单的解决方案。

或者,如果你更喜欢cuda 8,你可以下载deb文件,然后使用命令

dpkg-deb -x cuda_8.*.deb /usr/local/cuda-8.0

从deb文件中提取内容并将它们放在所需的目录中。

资料来源:http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#advanced-setup