python - TensorFlow 从源错误 ValueError : invalid literal for int() with base 10: '' during cuda path configuration? 构建

标签 python python-3.x linux tensorflow ubuntu

我在带有 cuda 10.1 和 cudnn 7.6.5-32 的 ubuntu 20.04 上,我正在尝试从源 tensorflow 2.3 构建,但在使用 ./configure 时我不断收到值错误?

Please specify the CUDA SDK version you want to use. [Leave empty to default to CUDA 10]: 10.1.243         


Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 7]: 7.6.5.32


Please specify the locally installed NCCL version you want to use. [Leave empty to use http://github.com/nvidia/nccl]: 


Please specify the comma-separated list of base paths to look for CUDA libraries and headers. [Leave empty to use the default]: /usr/src/linux-headers-5.4.0-42/include/linux/,/usr/src/linux-headers-5.4.0-42/include/uapi/linux/,/usr/src/linux-headers-5.4.0-26/include/uapi/linux/,/usr/src/linux-headers-5.4.0-26/include/linux/,/usr/share/man/man3/,/usr/include/linux/,/usr/include/,/usr/lib/cuda/,/usr/include/


Traceback (most recent call last):
  File "third_party/gpus/find_cuda_config.py", line 648, in <module>
    main()
  File "third_party/gpus/find_cuda_config.py", line 640, in main
    for key, value in sorted(find_cuda_config().items()):
  File "third_party/gpus/find_cuda_config.py", line 578, in find_cuda_config
    result.update(_find_cuda_config(cuda_paths, cuda_version))
  File "third_party/gpus/find_cuda_config.py", line 252, in _find_cuda_config
    cuda_header_path, header_version = _find_header(base_paths, "cuda.h",
  File "third_party/gpus/find_cuda_config.py", line 240, in _find_header
    return _find_versioned_file(base_paths, _header_paths(), header_name,
  File "third_party/gpus/find_cuda_config.py", line 230, in _find_versioned_file
    actual_version = get_version(file)
  File "third_party/gpus/find_cuda_config.py", line 247, in get_header_version
    version = int(_get_header_version(path, "CUDA_VERSION"))
ValueError: invalid literal for int() with base 10: ''
Asking for detailed CUDA configuration...
我运行了这个命令来获取基本路径,
$ locate cuda.h

/snap/gnome-3-34-1804/24/usr/include/linux/cuda.h
/snap/gnome-3-34-1804/36/usr/include/linux/cuda.h
/usr/include/cuda.h
/usr/include/linux/cuda.h
/usr/share/man/man3/cuda.h.3.gz
/usr/src/linux-headers-5.4.0-26/include/linux/cuda.h
/usr/src/linux-headers-5.4.0-26/include/uapi/linux/cuda.h
/usr/src/linux-headers-5.4.0-42/include/linux/cuda.h
/usr/src/linux-headers-5.4.0-42/include/uapi/linux/cuda.h
这是我的cuda安装路径,
$whereis cuda

cuda: /usr/lib/cuda /usr/include/cuda.h
这是我的 nvidia 和 cuda 版本,
$ nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
这是我的司机
$ nvidia-smi


Sun Aug  2 01:39:54 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100      Driver Version: 440.100      CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 750 Ti  Off  | 00000000:01:00.0  On |                  N/A |
| 27%   41C    P0     1W /  38W |    171MiB /  1997MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1049      G   /usr/lib/xorg/Xorg                            20MiB |
|    0      1859      G   /usr/lib/xorg/Xorg                            44MiB |
|    0      2058      G   /usr/bin/gnome-shell                          94MiB |
+-----------------------------------------------------------------------------+

最佳答案

从源代码构建具有 NVIDIA GPU 支持(或任何 CUDA 项目)的 Tensorflow 需要您安装完整的 CUDA 工具包(这意味着 CUDA 所需的所有必要依赖项)。注意 conda 分发的“cudatoolkit”包is not a full CUDA toolkit并且不能用于构建代码。
您没有安装 CUDA 工具包。因此,您无法构建 TensorFlow。
安装一个。

关于python - TensorFlow 从源错误 ValueError : invalid literal for int() with base 10: '' during cuda path configuration? 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63209583/

相关文章:

python - 在不运行测试的情况下制作(从源代码安装)python

linux - 如何在不使用 echo 的情况下更改输出颜色?

php - 使用 PHP 填充 Sh 脚本值

python - 在python中建立与某个网页的连接

python - numpy 函数的省时组合

python - python中的迷宫生成器

python - 使用 zip() 函数的 Python 列表理解的复杂度为 O(n)

python - Django 管理站点

python - Kivy 截图,背景清晰

python - 如何将 Instagram API 响应转换为 Python 3 字典?