在 Ubuntu 18.04.1 中安装 Tensorflow GPU 时出现问题

在 Ubuntu 18.04.1 中安装 Tensorflow GPU 时出现问题

我有一台装有 Ubuntu 18.04.1 和 anaconda 4.5.8 的新电脑,我正在尝试安装 tensorflow_gpu。显卡已安装在主板上,但驱动程序尚未安装。

我尝试按照本教程在 Ubuntu 18.04.1 中安装 tensorflow_gpu。

https://medium.com/@taylordenouden/installing-tensorflow-gpu-on-ubuntu-18-04-89a142325138

第一步是输入:

$ nvidia-smi 

由此我得到:

Command 'nvidia-smi' not found, but can be installed with:

sudo apt install nvidia-340      
sudo apt install nvidia-utils-390

因此我输入它们,认为这将允许 nvidia-smi 工作。

未找到命令“nvidia-smi”,但可以使用以下命令安装:

$sudo apt install nvidia-340      

这样就安装OK了

但是当我运行 sudo apt install nvidia-utils-390 时:

desktop:~$ sudo apt install nvidia-utils-390
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnvidia-compute-390
Suggested packages:
  nvidia-driver-390
The following packages will be REMOVED
  libcuda1-340 nvidia-opencl-icd-340
The following NEW packages will be installed
  libnvidia-compute-390 nvidia-utils-390
0 to upgrade, 2 to newly install, 2 to remove and 0 not to upgrade.
Need to get 20.9 MB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://gb.archive.ubuntu.com/ubuntu bionic/restricted amd64 libnvidia-compute-390 amd64 390.48-0ubuntu3 [20.6 MB]
Get:2 http://gb.archive.ubuntu.com/ubuntu bionic/restricted amd64 nvidia-utils-390 amd64 390.48-0ubuntu3 [321 kB]
Fetched 20.9 MB in 7s (2,861 kB/s)                                             
(Reading database ... 138972 files and directories currently installed.)
Removing libcuda1-340 (340.106-0ubuntu3) ...
Removing nvidia-opencl-icd-340 (340.106-0ubuntu3) ...
Selecting previously unselected package libnvidia-compute-390:amd64.
(Reading database ... 138957 files and directories currently installed.)
Preparing to unpack .../libnvidia-compute-390_390.48-0ubuntu3_amd64.deb ...
Unpacking libnvidia-compute-390:amd64 (390.48-0ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/libnvidia-compute-390_390.48-0ubuntu3_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libnvidia-ml.so', which is also in package nvidia-340 340.106-0ubuntu3
Selecting previously unselected package nvidia-utils-390.
Preparing to unpack .../nvidia-utils-390_390.48-0ubuntu3_amd64.deb ...
Unpacking nvidia-utils-390 (390.48-0ubuntu3) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-utils-390_390.48-0ubuntu3_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/nvidia-bug-report.sh', which is also in package nvidia-340 340.106-0ubuntu3
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-compute-390_390.48-0ubuntu3_amd64.deb
 /var/cache/apt/archives/nvidia-utils-390_390.48-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

现在,当我尝试 nvidia-smi 时,我得到:

desktop:~$ nvidia-smi
    NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Q1.) 我该如何撤消/修复这个损坏的安装?

Q2.) 我应该安装什么,以便当我输入 nvidia-smi 时,它会给我如教程中所示的输出,这样我就可以按照本教程的其余部分进行操作!

相关内容