【问题标题】:Installing PyOpenCL on Windows using Intel's SDK and pip使用 Intel 的 SDK 和 pip 在 Windows 上安装 PyOpenCL
【发布时间】:2020-06-03 17:53:44
【问题描述】:

these instructions 之后,我已经从here 下载并安装了英特尔的 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

P.S.1. 还发布了一个半相关问题 here

P.S.2. 根据thisthis 的帖子,应该有一个siteconf.py 文件,我可以在其中指定CL_INC_DIRCL_LIB_DIR 等环境变量。但是,我在硬盘驱动器上找不到上述文件,我不确定是否可以在使用 pip 包管理器时更改环境变量。我试过了

set CL_INC_DIR = [r'C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include']

cmd 无济于事。

P.S.3. 我尝试使用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.

P.S.4.我尝试按照说明here,但是命令

pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy

返回

查看索引:https://pypi.anaconda.org/carlkl/simple 错误:找不到满足 mingwpy 要求的版本(来自版本:无) 错误:没有为 mingwpy 找到匹配的分布

【问题讨论】:

    标签: python pip opencl intel pyopencl


    【解决方案1】:

    几年前我在 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 &lt;pyopencl_package.whl&gt;

    【讨论】:

    【解决方案2】:

    我今天早上经历了这个确切的问题。我终于能够按照此处的说明进行操作:http://www.minho-kim.com/courses/17sp43.635/pyopencl.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-20
      • 1970-01-01
      • 1970-01-01
      • 2013-07-04
      • 1970-01-01
      • 1970-01-01
      • 2021-06-19
      相关资源
      最近更新 更多