尊敬的各位朋友学者:
我目前遇到了一些问题:在pycharm终端使用pip install pycuda命令会出现构建 PyCUDA的 wheel失败,根据网上的建议,要去Christoph Gohlke
运行后出现这个错误:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘ProxyError(‘Cannot connect to proxy.’, TimeoutError(’_ssl.c:993: The handshake operation timed out’))': /simple/pycuda/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(SSLEOFError(8, ‘[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1010)’))’: /simple/pycuda/
Collecting pycuda
Using cached pycuda-2026.1.tar.gz (1.7 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Collecting pytools>=2011.2 (from pycuda)
Using cached pytools-2025.2.5-py3-none-any.whl.metadata (2.9 kB)
Collecting platformdirs>=2.2.0 (from pycuda)
Using cached platformdirs-4.5.1-py3-none-any.whl.metadata (12 kB)
Collecting mako (from pycuda)
Using cached mako-1.3.10-py3-none-any.whl.metadata (2.9 kB)
Collecting siphash24>=1.6 (from pytools>=2011.2->pycuda)
Using cached siphash24-1.8-cp312-cp312-win_amd64.whl.metadata (3.2 kB)
Collecting typing-extensions>=4.5 (from pytools>=2011.2->pycuda)
Using cached typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
Collecting MarkupSafe>=0.9.2 (from mako->pycuda)
Using cached markupsafe-3.0.3-cp312-cp312-win_amd64.whl.metadata (2.8 kB)
Using cached platformdirs-4.5.1-py3-none-any.whl (18 kB)
Using cached pytools-2025.2.5-py3-none-any.whl (98 kB)
Using cached siphash24-1.8-cp312-cp312-win_amd64.whl (76 kB)
Using cached typing_extensions-4.15.0-py3-none-any.whl (44 kB)
Using cached mako-1.3.10-py3-none-any.whl (78 kB)
Using cached markupsafe-3.0.3-cp312-cp312-win_amd64.whl (15 kB)
Building wheels for collected packages: pycuda
Building wheel for pycuda (pyproject.toml) … error
error: subprocess-exited-with-error
× Building wheel for pycuda (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [144 lines of output]
*************************************************************
*** I have detected that you have not run configure.py.
*************************************************************
*** Additionally, no global config files were found.
*** I will go ahead with the default configuration.
*** In all likelihood, this will not work out.
***
*** See README_SETUP.txt for more information.
***
*** If the build does fail, just re-run configure.py with the
*** correct arguments, and then retry. Good luck!
*************************************************************
*** HIT Ctrl-C NOW IF THIS IS NOT WHAT YOU WANT
*************************************************************
Continuing in 10 seconds…
Continuing in 9 seconds…
Continuing in 8 seconds…
Continuing in 7 seconds…
Continuing in 6 seconds…
Continuing in 5 seconds…
Continuing in 4 seconds…
Continuing in 3 seconds…
Continuing in 2 seconds…
Continuing in 1 seconds…
C:\Users\Administrator\AppData\Local\Temp\pip-build-env-vswg4mez\overlay\Lib\site-packages\setuptools_distutils\dist.py:289: UserWarning: Unknown distribution option: ‘test_requires’
warnings.warn(msg)
C:\Users\Administrator\AppData\Local\Temp\pip-build-env-vswg4mez\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: MIT License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-cpython-312\pycuda
copying pycuda\autoinit.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\autoprimaryctx.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\characterize.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\compiler.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\cumath.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\curandom.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\debug.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\driver.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\elementwise.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\gpuarray.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\reduction.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\scan.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\tools.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\_cluda.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\_mymako.py -> build\lib.win-amd64-cpython-312\pycuda
copying pycuda\__init__.py -> build\lib.win-amd64-cpython-312\pycuda
creating build\lib.win-amd64-cpython-312\pycuda\gl
copying pycuda\gl\autoinit.py -> build\lib.win-amd64-cpython-312\pycuda\gl
copying pycuda\gl\__init__.py -> build\lib.win-amd64-cpython-312\pycuda\gl
creating build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\cg.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\coordinate.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\inner.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\operator.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\packeted.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\pkt_build.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
copying pycuda\sparse\__init__.py -> build\lib.win-amd64-cpython-312\pycuda\sparse
creating build\lib.win-amd64-cpython-312\pycuda\compyte
copying pycuda\compyte\array.py -> build\lib.win-amd64-cpython-312\pycuda\compyte
copying pycuda\compyte\dtypes.py -> build\lib.win-amd64-cpython-312\pycuda\compyte
copying pycuda\compyte\__init__.py -> build\lib.win-amd64-cpython-312\pycuda\compyte
running egg_info
writing pycuda.egg-info\PKG-INFO
writing dependency_links to pycuda.egg-info\dependency_links.txt
writing requirements to pycuda.egg-info\requires.txt
writing top-level names to pycuda.egg-info\top_level.txt
reading manifest file 'pycuda.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'doc\source\*.rst'
warning: no files found matching 'doc\source\conf.py'
warning: no files found matching 'doc\source\_static\*.css'
warning: no files found matching 'doc\source\_templates\*.html'
warning: no files found matching '*.cpp' under directory 'bpl-subset\bpl_subset\boost'
warning: no files found matching '*.html' under directory 'bpl-subset\bpl_subset\boost'
warning: no files found matching '*.inl' under directory 'bpl-subset\bpl_subset\boost'
warning: no files found matching '*.txt' under directory 'bpl-subset\bpl_subset\boost'
warning: no files found matching '*.h' under directory 'bpl-subset\bpl_subset\libs'
warning: no files found matching '*.ipp' under directory 'bpl-subset\bpl_subset\libs'
warning: no files found matching '*.pl' under directory 'bpl-subset\bpl_subset\libs'
adding license file 'LICENSE'
writing manifest file 'pycuda.egg-info\SOURCES.txt'
C:\Users\Administrator\AppData\Local\Temp\pip-build-env-vswg4mez\overlay\Lib\site-packages\setuptools\command\build_py.py:212: _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)
creating build\lib.win-amd64-cpython-312\pycuda\cuda
copying pycuda\cuda\pycuda-complex-impl.hpp -> build\lib.win-amd64-cpython-312\pycuda\cuda
copying pycuda\cuda\pycuda-complex.hpp -> build\lib.win-amd64-cpython-312\pycuda\cuda
copying pycuda\cuda\pycuda-helpers.hpp -> build\lib.win-amd64-cpython-312\pycuda\cuda
copying pycuda\sparse\pkt_build_cython.pyx -> build\lib.win-amd64-cpython-312\pycuda\sparse
running build_ext
building '_driver' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[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: failed-wheel-build-for-install
× Failed to build installable wheels for some pyproject.toml based projects
╰─> pycuda