win11安装pycuda的一点点问题

问题:ERROR: Failed building wheel for pycuda

 C:\Users\97160\AppData\Local\Temp\pip-install-oi8pc0pg\pycuda_49ea4802a21a4336a69368c192f9cfce\src\cpp\cuda.hpp(23): fatal error C1083: 无法打开包括文件: “cudaProfiler.h”: No such file or directory
      C:\Users\97160\AppData\Local\Temp\pip-build-env-0snks3gb\overlay\Lib\site-packages\setuptools\command\build_py.py:201: _Warning: Package 'pycuda.cuda' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'pycuda.cuda' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'pycuda.cuda' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'pycuda.cuda' to be distributed and are
              already explicitly excluding 'pycuda.cuda' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects
  • 在建造pyproject.toml时报错,错误信息表明 pycuda 的安装需要先运行 configure.py 来配置编译参数

解决办法

Step1:下载 PyCUDA 源代码

pip download pycuda
  • 这会在当前目录下下载一个 pycuda-.tar.gz 文件。

Step2:解压 PyCUDA 源代码

tar -xvf pycuda-<version>.tar.gz

Step3:运行 configure.py

  • 进入解压后的 pycuda 目录,并运行 configure.py:
cd pycuda-<version>
python configure.py
  • 你需要在运行 configure.py 时指定 CUDA 的包含路径和库路径。假设 CUDA 安装在默认路径,可以这样运行:
python configure.py --cuda-root="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6"

Step4:安装 PyCUDA

pip install .

总结

通过运行 configure.py 配置编译参数,可以解决 pycuda 安装过程中遇到的问题。这些步骤确保编译器能够找到所需的 CUDA 文件。以下是完整的操作流程:

  1. 下载 pycuda 源代码。
  2. 解压源代码。
  3. 运行 configure.py 配置编译参数。
  4. 安装 pycuda。

确保 CUDA 工具包安装正确并且环境变量设置正确。如果有任何问题,请检查 README_SETUP.txt 文件中的详细说明。

相关推荐

  1. win11安装pycuda一点问题

    2024-06-13 10:38:01       10 阅读
  2. win11安装weblogic12C遇到奇怪问题

    2024-06-13 10:38:01       19 阅读
  3. win10win11安装pytorch(可用)

    2024-06-13 10:38:01       35 阅读
  4. win10下 mysql8.0.37.0 msi版本安装时出现问题

    2024-06-13 10:38:01       7 阅读
  5. Rust安装——Win10

    2024-06-13 10:38:01       34 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-06-13 10:38:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-06-13 10:38:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-06-13 10:38:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-06-13 10:38:01       20 阅读

热门阅读

  1. d3.js获取流程图不同的节点

    2024-06-13 10:38:01       5 阅读
  2. 在 macOS 上安装 Docker

    2024-06-13 10:38:01       8 阅读
  3. L1-022 奇偶分家

    2024-06-13 10:38:01       10 阅读
  4. 多进程挂起任务parallel

    2024-06-13 10:38:01       6 阅读
  5. MYSQL 三、mysql基础知识 4(存储过程与函数)

    2024-06-13 10:38:01       5 阅读
  6. sourcemap

    2024-06-13 10:38:01       9 阅读
  7. Python 中的 Pandas(数据分析与处理)

    2024-06-13 10:38:01       6 阅读
  8. 10个典型的MySQL笔试题和面试题

    2024-06-13 10:38:01       7 阅读
  9. 拜托:不要像鲍勃大叔那样重构

    2024-06-13 10:38:01       10 阅读
  10. 探索微软Edge

    2024-06-13 10:38:01       8 阅读