fatal error C1083: Cannot open include file: 'CL/cl.h'

↘锁芯ラ 提交于 2020-06-13 00:11:06

问题


I read all the solutions provided in this website in order to solve this problem, but it still exits. When I run this command in cmd in windows 10 C:\pyopencl-2016.2.1>setup.py install, this error will be shown:

c:\pyopencl-2016.2.1\src\c_wrapper\clinfo_ext.h(10) : fatal error C1083: 

Cannot open include file: 'CL/cl.h': No such file or directory
error: command 'C:\\Users\\Neda\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

Also, there is no cl.exe and CL/ in the paths mentioned above. I would really appreciate your attention.

EDITED: I also ran this command in cmd Command "pip install --global-option=build_ext --global-option="-DHAVE_GL=1" pyopencl and the problem was the same:

c:\users\neda\appdata\local\temp\pip-build-ugbqq9\pyopencl\src\c_wrapper\clinfo_ext.h(10) : fatal error C1083: Cannot open include file: 'CL/cl.h': No such file or directory
error: command '

C:\\Users\\Neda\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "c:\users\neda\appdata\local\enthought\canopy\user\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\neda\\appdata\\local\\temp\\pip-build-ugbqq9\\pyopencl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -DHAVE_GL=1 install --record c:\users\neda\appdata\local\temp\pip-l6bnzf-record\install-record.txt --single-version-externally-managed --compile --install-headers c:\users\neda\appdata\local\enthought\canopy\user\include\site\python2.7\pyopencl" failed with error code 1 in c:\users\neda\appdata\local\temp\pip-build-ugbqq9\pyopencl\

回答1:


Seems you don't have any OpenCL SDK installed.

There are different SDK from different providers:

  • NVIDIA – CUDA Toolkit
  • AMD – AMD APP SDK
  • Intel - OpenCL SDK

At first, install OpenCL SDK, and don't forget to setup right environment variable INCLUDE to point to your OpenCL include library (for example: INCLUDE = C:\Program Files (x86)\Intel\OpenCL SDK\6.3\include).




回答2:


I have successfully installed pyopencl on a Windows 10 AMD machine. For other Windows AMD users, read on.

The AMD APP SDK is now discontinued by AMD, however the last release version you can find on Github. I recommend you install it from here.

Next, you will need to specify a few command line flags to pass onto the compiler when building. I used:

pip3 install --global-option=build_ext --global-option="-Ic:\Program Files (x86)\OCL_SDK_Light\include" --global-option="-Lc:\Program Files (x86)\OCL_SDK_Light\lib\x86_64" pyopencl

This worked for me, you may have to adjust your -I and -L arguments according to where the OCL SDK installed to.




回答3:


I have already installed Intel SDK, Python 3.7 and Numpy on my Windows 10 with Intel CPU and GPU. Now I wanted to try pyOpenCL. Using this installation method below didn't help:

 pip install pyopencl

Instead, I followed the info on this page and then located the correct version of WHL file needed for my system, and have it installed successfully by running:

pip install pyopencl-2019.1.2+cl12-cp37-cp37m-win_amd64.whl

And test it like so:

import pyopencl as cl


来源:https://stackoverflow.com/questions/42881165/fatal-error-c1083-cannot-open-include-file-cl-cl-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!