先是想着尝鲜,安装了最新的CUDA11.4:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.4.1/local_installers/cuda-repo-ubuntu1804-11-4-local_11.4.1-470.57.02-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-4-local_11.4.1-470.57.02-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-4-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

结果安装pytorch时发现最新的1.9也只支持到了CUDA11.1,虽然不影响pytorch的安装成功,但是跑代码时用到cuda时就报下面的错误:

GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
If you want to use the GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
>>> print(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3/lib/python3.9/site-packages/torch/tensor.py", line 193, in __repr__
    return torch._tensor_str._str(self)
  File "/usr/local/python3/lib/python3.9/site-packages/torch/_tensor_str.py", line 383, in _str
    return _str_intern(self)
  File "/usr/local/python3/lib/python3.9/site-packages/torch/_tensor_str.py", line 358, in _str_intern
    tensor_str = _tensor_str(self, indent)
  File "/usr/local/python3/lib/python3.9/site-packages/torch/_tensor_str.py", line 242, in _tensor_str
    formatter = _Formatter(get_summarized_data(self) if summarize else self)
  File "/usr/local/python3/lib/python3.9/site-packages/torch/_tensor_str.py", line 90, in __init__
    nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: no kernel image is available for execution on the device

于是使用下面的命令删掉CUDA11.4:

sudo apt-get --purge remove "cuda*"
sudo apt-get --purge remove "*nvidia*470"

然后再使用下面的命令安装CUDA11.1.1

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

结果报下面的错误:

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda : Depends: cuda-11-1 (>= 11.1.1) but it is not going to be installed
 nvidia-dkms-470 : Depends: nvidia-kernel-source-470 but it is not going to be installed
                   Depends: nvidia-kernel-common-470 (= 470.57.02-0ubuntu1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

反复删除安装了几遍还是这样,想想怎么还提示

cuda : Depends: cuda-11-1 (>= 11.1.1) but it is not going to be installed

是不是CUDA11.4的包没删除干净,于是执行:

sudo apt-get --purge remove "cuda*"
sudo apt-get --purge remove "*nvidia*"

把cuda和nvidia驱动所有相关的东西都删了(nvidia docker2也被误删了),再安装CUDA11.1.1,就顺利成功了。

不过由于把nvidia docker2也误删了,所以还得再安装一下:

sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker

如果安装CUDA后没有重启让driver生效,那么在通过docker run --gpus all ...或者nvidia-docker run ...启动nvidia docker时会报错:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 0 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: nvml error: driver/library version mismatch\\\\n\\\"\"": unknown.

这种错误一般是因为GPU驱动没有安装或者安装后没有生效。

安装CUDA时报错packages have unmet dependencies的一个可能原因相关推荐

  1. ubuntu报错解决:The following packages have unmet dependencies:

    我安装了全新的ubuntu,然后安装软件时报错了: root@ubuntu:/home/zhang# apt install g++ Reading package lists... Done Bui ...

  2. ubuntu 安装依赖包时出现The following packages have unmet dependencies:

    本人环境:ubuntu18.04 docker中安装opencv的依赖apt install libopencv-dev出现此问题: Reading package lists... Done Bui ...

  3. The following packages have unmet dependencies: libx11-dev : Depends: libx11-6 (= 2:1.6.7-1+deb10u2

    ubuntu apt-get install 时报错:Depends: ***(=某版本)but***(另一版本)is to be installed 比如: The following packag ...

  4. The following packages have unmet dependencies: deepin.com.wechat:i386 : Depends: deepin-wine:i386

    系统之前装过微信,安装gitk时报错: Heisenberg海森堡:~$ sudo apt-get -f install gitk Reading package lists... Done Buil ...

  5. The following packages have unmet dependencies: build-essential : Depends: libc6-dev but it is not

    本文为转载,原文地址: http://blog.csdn.net/duanlove/article/details/54666441 操作系统(Ubuntu server)环境: uname -a L ...

  6. The following packages have unmet dependencies

    background: 之前使用dpkg装mysql时候,失败了,应该是把pkg的版本弄乱了. 这次安装ldap,报该错误:The following packages have unmet depe ...

  7. The following packages have unmet dependencies错误

    转载自:https://blog.csdn.net/weixin_33804582/article/details/94657169 但是我这边,是通过换成aptitude 去安装就行了 sudo a ...

  8. win10中anaconda安装tensorflow时报错Traceback (most recent call last): File “E:\Anaconda3\lib\site-packag

    windows系统anaconda安装tensorflow时报错解决办法. 报错: Traceback (most recent call last): File "E:\Anaconda3 ...

  9. 解决The following packages have unmet dependencies: vim : Depends: vim-runtime (= 2:7.4.052-1ubu

    仔细看报错说明,把报错的软件删了,再当前的软件,刚刚删了的会自动补上合适的版本 sudo apt-get remove vim-runtime sudo apt-get install vim roo ...

最新文章

  1. [泰然翻译] cocos2d programming guide翻译(10)
  2. 如何预约升级鸿蒙,超过66万人预约,华为亮出真正王牌旗舰,支持优先升级鸿蒙系统...
  3. Build 2021 :正式发布.NET 6 Preview4
  4. 面试官不讲武德,居然让我讲讲蠕虫和金丝雀!
  5. 12 FI配置-财务会计-分配会计核算原理至分类帐组
  6. 使用LDA模型对新的文档进行分类
  7. 基于JAVA+SpringBoot+Mybatis+MYSQL的飞机订票系统
  8. 2016电大计算机网考,2016电大计算机网考选择题及答案.doc
  9. 如何成为一名更出色的开发者?
  10. WAMP安装curl扩展并发起https请求
  11. JSONString 与 JSONData 与字典或者数组互相转化
  12. BAT4行代码让电脑蓝屏(无伤害)
  13. 全国基础地理数据库数据预处理
  14. 电信计费系列2-手机+座机计费
  15. HTL/TTL转光纤模块
  16. 2014中国计量学院matlab考试卷,南京信息工程大学2011普本电路分析期末试卷A及答案...
  17. 湖南张家界旅游景区项目方案书
  18. 2021年7月火影几点服务器维护完,火影忍者手游2021年5月27日更新公告
  19. 平台网络安全能力知多少
  20. 上下文切换是在做什么事情?

热门文章

  1. UnboundLocalError: local variable ‘Num_fSu‘ referenced before assignment
  2. codeforces每日5题(均1500)-第八天
  3. win8/win10微信QQ邮箱可登陆,浏览器显示无网络连接
  4. Misc训练笔记(一)
  5. OSChina 周日乱弹 —— 我们今天不上班!
  6. 【软件定义汽车】【架构篇】最全整车电子电气E/E架构(含汽车公司)
  7. 年薪120W的架构师简历你见过吗?java程序员该如何达到?
  8. 企业级网络性能优化 课内8 vlanif2in1
  9. 树莓派与matlab联动并安装opencv
  10. 父亲发现高三女儿早恋 机智做法让网友惊呆