我尝试按照大部分官方指南在 Ubuntu 18.04 上安装 Nvidia 驱动程序以使用 Cuda。但我要使用的某些库需要另一个版本的 Cuda,因此我尝试手动重新安装它。我在安装过程中没有做笔记,所以我不知道到底出了什么问题。
现在,除了驱动程序问题之外,我甚至无法正确更新或重启系统:
在正常模式下,系统无法启动(或者可以启动,但要等很长时间;我等了一个小时,然后关机)。我现在正在以不安全模式加载,但并非所有东西都是这样加载的。例如,第二个屏幕没有连接,亮度没有调整,也没有进入睡眠模式。
如果我尝试通过终端或软件更新程序进行更新,我会收到错误。
Check if you are using third party repositories. If so disable them, since they are a common source of problems.
Furthermore run the following command in a Terminal: apt-get install -f
Transaction failed: The package system is broken
The following packages have unmet dependencies:
nvidia-cuda-toolkit: Depends: nvidia-profiler (= 9.1.85-3ubuntu1) but 9.1.85-3ubuntu1 is installed
Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not installed
Depends: opencl-dev but it is a virtual package
Depends: libgcc1 (>= 1:3.0) but 1:8.3.0-6ubuntu1~18.04.1 is installed
命令之后 sudo apt 更新 sudo apt 完全升级 错误是:
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
nvidia-cuda-toolkit : Depends: nvidia-cuda-dev (= 9.1.85-3ubuntu1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
如果我尝试sudo apt--fix-broken 安装我明白了
Unpacking nvidia-cuda-dev (9.1.85-3ubuntu1) ...
dpkg: error processing archive /var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb (--unpack):
trying to overwrite '/usr/include/cublas.h', which is also in package libcublas-dev 10.2.2.89-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我也尝试过这样的命令 sudo apt-get clean sudo apt 安装 nvidia-settings sudo apt 自动删除 sudo apt 自动清理 sudo ubuntu-drivers 自动安装
但出现了同样的错误。
我尝试删除错误指向的文件: sudo mv nvidia-cuda-dev_9.1.85-3ubuntu1_amd64.deb /home/sergey/Trash/ sudo mv cublas.h /home/sergey/Trash/
但它并没有什么效果。
我也无法删除 nvidia 模块:
sudo apt-get 删除 --purge '^nvidia-.*'
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cuda-drivers : Depends: nvidia-compute-utils-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-dkms-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-driver-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-kernel-common-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-kernel-source-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-utils-440 (>= 440.33.01) but it is not going to be installed
Depends: nvidia-modprobe (>= 440.33.01)
Depends: nvidia-settings (>= 440.33.01) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我的系统是 Ubuntu 18.04.3 LTS。 nvidia-smi 输出 卡信息
我看到其他人也有类似的问题,但他们的解决方案对我来说不起作用。如果能得到任何帮助,我将不胜感激。
UPD:我注意到 CUDA 确实在运行。例如,在 Pytorch 中。