CUDA driver version is insufficient for CUDA runtime version

用 conda 安装完 tensorflow-gpu : (注意:conda 自动帮你装了最新的 cuda10!

>>> conda install tensorflow-gpu
Solving environment: done

## Package Plan ##

  environment location: D:\ProgramFilesNoSpace\Miniconda3\envs\py36

  added / updated specs:
    - tensorflow-gpu


The following NEW packages will be INSTALLED:

    cudatoolkit:     10.0.130-0                https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cudnn:           7.3.1-cuda10.0_0          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow:      1.13.1-gpu_py36h9006a92_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-base: 1.13.1-gpu_py36h871c8ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-gpu:  1.13.1-h0d30ee6_0         https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

Proceed ([y]/n)? n  # 这个 n 是后来加的

一跑程序就出现:

Traceback (most recent call last):
  File "D:/workspace/pythonProj/test2.py", line 61, in <module>
    sess = tf.Session()
  File "D:\ProgramFilesNoSpace\Miniconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 1551, in __init__
    super(Session, self).__init__(target, graph, config=config)
  File "D:\ProgramFilesNoSpace\Miniconda3\envs\py36\lib\site-packages\tensorflow\python\client\session.py", line 676, in __init__
    self._session = tf_session.TF_NewSessionRef(self._graph._c_graph, opts)
tensorflow.python.framework.errors_impl.InternalError: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version

看看 conda 安装的 cuda 版本

>>> conda list
# packages in environment at D:\ProgramFilesNoSpace\Miniconda3\envs\py36:
#
# Name                    Version                   Build  Channel
...
cudatoolkit               10.0.130                      0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cudnn                     7.3.1                cuda10.0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main


检查显卡驱动版本:

>>> nvidia-smi
Fri Mar 29 11:54:57 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 399.24                 Driver Version: 399.24                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name            TCC/WDDM | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce MX150      WDDM  | 00000000:01:00.0 Off |                  N/A |
| N/A   35C    P8    N/A /  N/A |     64MiB /  2048MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

版本为 399

再一查 tensorflow 系统要求:
https://www.tensorflow.org/install/gpu#software_requirements

在这里插入图片描述
搞什么嘛,只支持到 cuda 9.0

只好把 cuda 给卸了

>>> conda uninstall cudnn
Solving environment: done

## Package Plan ##

  environment location: D:\ProgramFilesNoSpace\Miniconda3\envs\py36

  removed specs:
    - cudnn


The following packages will be REMOVED:

    cudnn:           7.3.1-cuda10.0_0          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow:      1.13.1-gpu_py36h9006a92_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-base: 1.13.1-gpu_py36h871c8ca_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-gpu:  1.13.1-h0d30ee6_0         https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main



>>> conda uninstall cudatoolkit
Solving environment: done

## Package Plan ##

  environment location: D:\ProgramFilesNoSpace\Miniconda3\envs\py36

  removed specs:
    - cudatoolkit


The following packages will be REMOVED:

    cudatoolkit: 10.0.130-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

现在重装 tensorflow-gpu,选择版本 1.9,对应 cuda9.0

>conda install tensorflow-gpu==1.9
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: D:\ProgramFilesNoSpace\Miniconda3\envs\py36

  added / updated specs:
    - tensorflow-gpu==1.9


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cudatoolkit-9.0            |                1       339.8 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cudnn-7.3.1                |        cuda9.0_0       170.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorboard-1.9.0          |   py36he025d50_0         3.3 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-1.9.0           |gpu_py36hfdee9c2_1           4 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-base-1.9.0      |gpu_py36h6e53903_0        78.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-gpu-1.9.0       |       hf154084_0           3 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:       592.7 MB

The following NEW packages will be INSTALLED:

  cudatoolkit        anaconda/pkgs/main/win-64::cudatoolkit-9.0-1
  cudnn              anaconda/pkgs/main/win-64::cudnn-7.3.1-cuda9.0_0
  tensorflow         anaconda/pkgs/main/win-64::tensorflow-1.9.0-gpu_py36hfdee9c2_1
  tensorflow-base    anaconda/pkgs/main/win-64::tensorflow-base-1.9.0-gpu_py36h6e53903_0
  tensorflow-gpu     anaconda/pkgs/main/win-64::tensorflow-gpu-1.9.0-hf154084_0

The following packages will be DOWNGRADED:

  tensorboard                         1.13.1-py36h33f27b4_0 --> 1.9.0-py36he025d50_0

发现 conda 还是不错的, 会自动把刚才没有删干净的 tensorboard 自动降级(downgrade)

### 升级CUDA驱动以匹配CUDA运行时版本 要解决“CUDA driver version is insufficient for CUDA runtime version”的问题,可以通过升级显卡驱动来实现。以下是详细的解决方案: #### 显卡驱动的重要性 显卡驱动程序定义了硬件的功能边界,并影响可以安装的CUDA Toolkit的最大版本[^2]。如果当前使用的CUDA运行时版本高于已安装的显卡驱动所支持的版本,则会出现错误。 #### 驱动与CUDA工具包的关系 驱动具有向下的兼容性,这意味着较新的驱动通常能够支持旧版CUDA Toolkit,但它也限定了可安装CUDA Toolkit的最高版本。因此,在尝试更新CUDA Toolkit前,应优先确认并升级到合适的显卡驱动版本。 #### 如何检查现有驱动版本 在Linux系统下,可通过以下命令查看当前NVIDIA驱动版本: ```bash nvidia-smi ``` 该命令会显示当前系统的驱动版本号以及其他相关信息[^4]。 #### 查找所需的驱动版本 根据目标CUDA运行时版本的需求,访问[NVIDIA官方文档](https://docs.nvidia.com/cuda/)查询对应的最低驱动需求。例如,对于特定版本CUDA Toolkit,可能需要至少某个版本的驱动程序才能正常运作[^1]。 #### 安装最新驱动 为了确保兼容性和性能优化,建议下载并安装最新的稳定版NVIDIA驱动。具体步骤如下: - 访问[NVIDIA官方网站](https://www.nvidia.com/Download/index.aspx),输入具体的GPU型号、操作系统及其他必要参数。 - 下载推荐的驱动程序文件。 - 停止X服务器(如果有),卸载现有的驱动程序(通过`apt-get remove --purge nvidia*`或其他方式),然后按照说明完成新驱动的安装过程[^3]。 #### 更新环境变量 成功安装新版驱动之后,重新启动计算机使更改生效。接着验证驱动是否正确加载并通过测试脚本或应用程序再次执行先前失败的操作以确认问题已被解决。 ```python import torch print(torch.cuda.is_available()) # 应返回True表示可用 ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

颹蕭蕭

白嫖?

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值