![](/img/trans.png)
[英]Having Problem Installing Pyopencl on Windows 10 Machine Using Pip
[英]Installing PyOpenCL on Windows using Intel's SDK and pip
按照这些说明,我从这里下载并安装了英特尔的 OpenCL™ SDK(英特尔® System Studio)。 cl.h
文件在文件夹中
C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include\CL
但是在运行时
pip install pyopencl
我收到很长的错误消息
Building wheel for pyopencl (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python38\python.exe' 'c:\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\fsfar\AppData\Local\Temp\tmpsufv5353'
cwd: C:\Users\fsfar\AppData\Local\Temp\pip-install-cthadcch\pyopencl
Complete output (95 lines):
---------------------------------------------------------------------------
Mako is not installed.
---------------------------------------------------------------------------
That is not a problem, as most of PyOpenCL will be just fine
without it. Some higher-level parts of pyopencl (such as
pyopencl.reduction) will not function without the templating engine
Mako [1] being installed. If you would like this functionality to
work, you might want to install Mako after you finish
installing PyOpenCL.
Simply type
python -m pip install mako
either now or after the installation completes to fix this.
[1] http://www.makotemplates.org/
---------------------------------------------------------------------------
Hit Ctrl-C now if you'd like to think about the situation.
---------------------------------------------------------------------------
Continuing in 1 seconds...
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pyopencl
copying pyopencl\algorithm.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\array.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\bitonic_sort.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\bitonic_sort_templates.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\cache.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\capture_call.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\clmath.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\clrandom.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\cltypes.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\elementwise.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\invoker.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\ipython_ext.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\reduction.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\scan.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\tools.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\version.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\_buffers.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\_cluda.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\_mymako.py -> build\lib.win-amd64-3.8\pyopencl
copying pyopencl\__init__.py -> build\lib.win-amd64-3.8\pyopencl
creating build\lib.win-amd64-3.8\pyopencl\characterize
copying pyopencl\characterize\performance.py -> build\lib.win-amd64-3.8\pyopencl\characterize
copying pyopencl\characterize\__init__.py -> build\lib.win-amd64-3.8\pyopencl\characterize
creating build\lib.win-amd64-3.8\pyopencl\compyte
copying pyopencl\compyte\array.py -> build\lib.win-amd64-3.8\pyopencl\compyte
copying pyopencl\compyte\dtypes.py -> build\lib.win-amd64-3.8\pyopencl\compyte
copying pyopencl\compyte\__init__.py -> build\lib.win-amd64-3.8\pyopencl\compyte
creating build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_elemwise.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_reduction.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\setup_opencl.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_elemwise.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_ndarray.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\__init__.py -> build\lib.win-amd64-3.8\pyopencl\compyte\ndarray
running egg_info
writing pyopencl.egg-info\PKG-INFO
writing dependency_links to pyopencl.egg-info\dependency_links.txt
writing requirements to pyopencl.egg-info\requires.txt
writing top-level names to pyopencl.egg-info\top_level.txt
reading manifest file 'pyopencl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.h'
warning: no files found matching 'doc\_static\*.css'
warning: no files found matching 'doc\_templates\*.html'
warning: no files found matching '*.py.in'
writing manifest file 'pyopencl.egg-info\SOURCES.txt'
creating build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-airy.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j-complex.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-y.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-complex.h -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-eval-tbl.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-hankel-complex.cl -> build\lib.win-amd64-3.8\pyopencl\cl
copying pyopencl\cl\pyopencl-ranluxcl.cl -> build\lib.win-amd64-3.8\pyopencl\cl
creating build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\array.h -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\openclfeatures.h -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\philox.cl -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\threefry.cl -> build\lib.win-amd64-3.8\pyopencl\cl\pyopencl-random123
running build_ext
building 'pyopencl._cl' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -Ipybind11/include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\pybind11\include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\pybind11\include -IC:\Users\fsfar\AppData\Local\Temp\pip-build-env-gqyddbnz\overlay\Lib\site-packages\numpy\core\include -Ic:\python38\include -Ic:\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsrc/wrap_constants.cpp /Fobuild\temp.win-amd64-3.8\Release\src/wrap_constants.obj -fvisibility=hidden /EHsc /DVERSION_INFO=\"2020.1\"
cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'
wrap_constants.cpp
c:\users\fsfar\appdata\local\temp\pip-install-cthadcch\pyopencl\src\wrap_cl.hpp(57): fatal error C1083: Cannot open include file: 'CL/cl.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for pyopencl
Failed to build pyopencl
ERROR: Could not build wheels for pyopencl which use PEP 517 and cannot be installed directly
PS1。 此处还发布了一个半相关的问题。
PS2。 根据这个和这个帖子,应该有一个siteconf.py
文件,我可以在其中指定环境变量,例如CL_INC_DIR
和CL_LIB_DIR
。 但是,我在硬盘驱动器上找不到上述文件,我不确定在使用 pip package 管理器时是否可以更改环境变量。 我试过了
set CL_INC_DIR = [r'C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include']
在cmd
无济于事。
PS3。 我尝试使用pipwin
安装:
pip install pipwin
pipwin install pyopencl
但是在 python 中运行import pyopencl
时,我收到错误消息
c:\python38\lib\site-packages\pyopencl\__init__.py in <module>
37
38 try:
---> 39 import pyopencl._cl as _cl
40 except ImportError:
41 import os
ImportError: DLL load failed while importing _cl: The specified procedure could not be found.
PS4。 我尝试按照此处的说明进行操作,但命令
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
返回
Looking in indexes: https://pypi.anaconda.org/carlkl/simple ERROR: Could not find a version that satisfies the requirement mingwpy (from versions: none) ERROR: No matching distribution found for mingwpy
几年前,我在 Ubuntu 及以下帮助我遇到了类似的问题:
pip install --global-option=build_ext --global-option="-I/opt/AMDAPPSDK-3.0/include" --global-option="-L/opt/AMDAPPSDK-3.0/lib/x86_64" pyopencl
当然,路径需要根据您的情况进行调整。 如果它仍然不起作用,请尝试更改路径以使用 Unix/Linux 上的正斜杠 - 尽管在 Windows 上,但有时这是必要的。
或者,您可能想要使用已经预编译的whl
文件。 例如这里有一些: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl
然后安装即可: python -m pip install <pyopencl_package.whl>
我今天早上经历了这个确切的问题。 我终于能够按照此处的说明进行操作: http://www.minho-kim.com/courses/17sp43.635/pyopencl.html 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.