当前位置:   article > 正文

安装 pycuda 出现 PEP517 的错误_building wheel for psutil (pep 517) ... error

building wheel for psutil (pep 517) ... error

执行:pip install pycuda

出现:Building wheel for pycuda (PEP 517) ... error

  1. Building wheels for collected packages: pycuda, pytools
  2. Building wheel for pycuda (PEP 517) ... error
  3. ERROR: Command errored out with exit status 1:
  4. command: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp8diqrj_c
  5. cwd: /tmp/pip-install-xt280urn/pycuda_5d4c81cb559b4a6fa572a62bf9757598
  6. Complete output (101 lines):
  7. *************************************************************
  8. *** I have detected that you have not run configure.py.
  9. *************************************************************
  10. *** Additionally, no global config files were found.
  11. *** I will go ahead with the default configuration.
  12. *** In all likelihood, this will not work out.
  13. ***
  14. *** See README_SETUP.txt for more information.
  15. ***
  16. *** If the build does fail, just re-run configure.py with the
  17. *** correct arguments, and then retry. Good luck!
  18. *************************************************************
  19. *** HIT Ctrl-C NOW IF THIS IS NOT WHAT YOU WANT
  20. *************************************************************
  21. Continuing in 1 seconds...
  22. running bdist_wheel
  23. running build
  24. running build_py
  25. creating build
  26. creating build/lib.linux-x86_64-3.8
  27. creating build/lib.linux-x86_64-3.8/pycuda
  28. copying pycuda/cumath.py -> build/lib.linux-x86_64-3.8/pycuda
  29. copying pycuda/compiler.py -> build/lib.linux-x86_64-3.8/pycuda
  30. copying pycuda/_cluda.py -> build/lib.linux-x86_64-3.8/pycuda
  31. copying pycuda/elementwise.py -> build/lib.linux-x86_64-3.8/pycuda
  32. copying pycuda/characterize.py -> build/lib.linux-x86_64-3.8/pycuda
  33. copying pycuda/tools.py -> build/lib.linux-x86_64-3.8/pycuda
  34. copying pycuda/debug.py -> build/lib.linux-x86_64-3.8/pycuda
  35. copying pycuda/autoinit.py -> build/lib.linux-x86_64-3.8/pycuda
  36. copying pycuda/autoprimaryctx.py -> build/lib.linux-x86_64-3.8/pycuda
  37. copying pycuda/scan.py -> build/lib.linux-x86_64-3.8/pycuda
  38. copying pycuda/reduction.py -> build/lib.linux-x86_64-3.8/pycuda
  39. copying pycuda/_mymako.py -> build/lib.linux-x86_64-3.8/pycuda
  40. copying pycuda/driver.py -> build/lib.linux-x86_64-3.8/pycuda
  41. copying pycuda/curandom.py -> build/lib.linux-x86_64-3.8/pycuda
  42. copying pycuda/__init__.py -> build/lib.linux-x86_64-3.8/pycuda
  43. copying pycuda/gpuarray.py -> build/lib.linux-x86_64-3.8/pycuda
  44. creating build/lib.linux-x86_64-3.8/pycuda/gl
  45. copying pycuda/gl/autoinit.py -> build/lib.linux-x86_64-3.8/pycuda/gl
  46. copying pycuda/gl/__init__.py -> build/lib.linux-x86_64-3.8/pycuda/gl
  47. creating build/lib.linux-x86_64-3.8/pycuda/sparse
  48. copying pycuda/sparse/packeted.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  49. copying pycuda/sparse/operator.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  50. copying pycuda/sparse/coordinate.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  51. copying pycuda/sparse/cg.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  52. copying pycuda/sparse/pkt_build.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  53. copying pycuda/sparse/inner.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  54. copying pycuda/sparse/__init__.py -> build/lib.linux-x86_64-3.8/pycuda/sparse
  55. creating build/lib.linux-x86_64-3.8/pycuda/compyte
  56. copying pycuda/compyte/array.py -> build/lib.linux-x86_64-3.8/pycuda/compyte
  57. copying pycuda/compyte/dtypes.py -> build/lib.linux-x86_64-3.8/pycuda/compyte
  58. copying pycuda/compyte/__init__.py -> build/lib.linux-x86_64-3.8/pycuda/compyte
  59. running egg_info
  60. /usr/local/lib/python3.8/dist-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'test_requires'
  61. warnings.warn(msg)
  62. warning: no files found matching 'doc/source/*.rst'
  63. warning: no files found matching 'doc/source/conf.py'
  64. warning: no files found matching 'doc/source/_static/*.css'
  65. warning: no files found matching 'doc/source/_templates/*.html'
  66. warning: no files found matching '*.cpp' under directory 'bpl-subset/bpl_subset/boost'
  67. warning: no files found matching '*.html' under directory 'bpl-subset/bpl_subset/boost'
  68. warning: no files found matching '*.inl' under directory 'bpl-subset/bpl_subset/boost'
  69. warning: no files found matching '*.txt' under directory 'bpl-subset/bpl_subset/boost'
  70. warning: no files found matching '*.h' under directory 'bpl-subset/bpl_subset/libs'
  71. warning: no files found matching '*.ipp' under directory 'bpl-subset/bpl_subset/libs'
  72. warning: no files found matching '*.pl' under directory 'bpl-subset/bpl_subset/libs'
  73. writing manifest file 'pycuda.egg-info/SOURCES.txt'
  74. creating build/lib.linux-x86_64-3.8/pycuda/cuda
  75. copying pycuda/cuda/pycuda-complex-impl.hpp -> build/lib.linux-x86_64-3.8/pycuda/cuda
  76. copying pycuda/cuda/pycuda-complex.hpp -> build/lib.linux-x86_64-3.8/pycuda/cuda
  77. copying pycuda/cuda/pycuda-helpers.hpp -> build/lib.linux-x86_64-3.8/pycuda/cuda
  78. copying pycuda/sparse/pkt_build_cython.pyx -> build/lib.linux-x86_64-3.8/pycuda/sparse
  79. running build_ext
  80. creating build/temp.linux-x86_64-3.8
  81. creating build/temp.linux-x86_64-3.8/bpl-subset
  82. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset
  83. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs
  84. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/python
  85. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/python/src
  86. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/python/src/converter
  87. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/python/src/object
  88. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/smart_ptr
  89. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/smart_ptr/src
  90. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/system
  91. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/system/src
  92. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/thread
  93. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/thread/src
  94. creating build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/thread/src/pthread
  95. creating build/temp.linux-x86_64-3.8/src
  96. creating build/temp.linux-x86_64-3.8/src/cpp
  97. creating build/temp.linux-x86_64-3.8/src/wrapper
  98. x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -O3 -DNDEBUG -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION=1 -DBOOST_PYTHON_SOURCE=1 -Dboost=pycudaboost -DBOOST_THREAD_DONT_USE_CHRONO=1 -DPYGPU_PACKAGE=pycuda -DPYGPU_PYCUDA=1 -DHAVE_CURAND=1 -Isrc/cpp -Ibpl-subset/bpl_subset -I/usr/local/cuda/include -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/include/python3.8 -c bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.cpp -o build/temp.linux-x86_64-3.8/bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.o
  99. In file included from bpl-subset/bpl_subset/boost/python/detail/prefix.hpp:13:0,
  100. from bpl-subset/bpl_subset/boost/python/handle.hpp:8,
  101. from bpl-subset/bpl_subset/boost/python/converter/arg_to_python_base.hpp:7,
  102. from bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.cpp:6:
  103. bpl-subset/bpl_subset/boost/python/detail/wrap_python.hpp:50:11: fatal error: pyconfig.h: No such file or directory
  104. # include <pyconfig.h>
  105. ^~~~~~~~~~~~
  106. compilation terminated.
  107. error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  108. ----------------------------------------
  109. ERROR: Failed building wheel for pycuda
  110. Building wheel for pytools (setup.py) ... done
  111. Created wheel for pytools: filename=pytools-2022.1.12-py2.py3-none-any.whl size=65018 sha256=2f79761cd040baf74f025c6e24389b80090418b274cfa64973308c7e1f2748f1
  112. Stored in directory: /tmp/pip-ephem-wheel-cache-5i9u00g4/wheels/d6/c4/2a/41a750b89bfe174e3f6ee7c874e2c8595b94d2f924dcf53755
  113. Successfully built pytools
  114. Failed to build pycuda
  115. ERROR: Could not build wheels for pycuda which use PEP 517 and cannot be installed directly

使用:pip install pycuda --no-binary :all:

不解决问题。

从源码编译,解决问题。

1、下载 pycuda-2021.1.tar.gz

2、tar xfz pycuda-2021.1.tar.gz

3、cd pycuda-2021.1

4、python3 configure.py --cuda-root=/usr/local/cuda   

5、make install

如果有找不到 pyconfig.h 的错误,就安装 python3-dev。

如果有找不到 nvcc 的错误,就 export CUDA_ROOT=/usr/local/cuda/bin。

2022-11-04:

在 安装了 python3-dev 后,直接 pip install pycuda 也会成功。

参考:

Installing PyCUDA on Linux - Andreas Klöckner's Former Wiki

pycuda -- 'CUDA_ROOT not set, and nvcc not in path.' - Stack Overflow

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/946985
推荐阅读
相关标签
  

闽ICP备14008679号