简体   繁体   English

在Windows 8(x64)中安装期间PyOpenCL“致命错误:CL / cl.h:没有此类文件或目录”错误

[英]PyOpenCL “fatal error: CL/cl.h: No such file or directory” error during installation in Windows 8 (x64)

After searching a lot for solutions to this problem, I found that this particular error has not been documented properly for Windows. 在仔细搜索了这个问题的解决方案之后,我发现Windows没有正确记录这个特定的错误。 So I have decided to post this issue along with the solution. 所以我决定将此问题与解决方案一起发布。 Sorry if I am posting this in the wrong section. 对不起,如果我在错误的部分发布此内容。 I hope this solution will help users with the PyOpenCL installation error in the future. 我希望这个解决方案将来会帮助用户解决PyOpenCL安装错误。 Please note that the examples used here are for ATI Radeon GPUs that supports the AMD OpenCL SDK SDK. 请注意,此处使用的示例适用于支持AMD OpenCL SDK SDK的ATI Radeon GPUs For other GPUs , please refer to their respective parameters and implement them as necessary. 对于其他GPUs ,请参考各自的参数并根据需要实施。 Also do not attempt to install using pip if the installation fails. 如果安装失败,也不要尝试使用pip进行安装。 Instead download a zipped copy of pyopencl from here . 而是从这里下载pyopencl的压缩副本。

So the error message while installing PyOpenCL is: 所以安装PyOpenCL时的错误信息是:

In file included from src/wrapper/wrap_cl.cpp:1:0: 在src / wrapper / wrap_cl.cpp中包含的文件中:1:0:
src/wrapper/wrap_cl.hpp:27:19: fatal error: CL/cl.h: No Such File or Directory src / wrapper / wrap_cl.hpp:27:19:致命错误:CL / cl.h:没有这样的文件或目录
error: command 'gcc' failed with exit status 1 错误:命令'gcc'失败,退出状态为1

In order to solve this, one must know that the default CL/cl.h is usually stored in: C:/Program Files (x86)/.../include/CL . 为了解决这个问题,必须知道默认的CL / cl.h通常存储在: C:/Program Files (x86)/.../include/CL But since, (x86) is not identifiable by the gcc compiler, what you can do is this: 但是,因为(x86)无法通过gcc编译器识别,你可以做的是:

  1. Copy the CL folder inside C:/Program Files (x86)/AMD APP SDK/2.9-1/include and paste it in a separate location such as the directory where you have downloaded pyopencl.zip . 复制C:/Program Files (x86)/AMD APP SDK/2.9-1/includeCL文件夹并将其粘贴到一个单独的位置,例如您下载pyopencl.zip的目录。
  2. Also copy the x86_64 folder inside C:/Program Files (x86)/AMD APP SDK/2.9-1/lib and paste it in the same directory as the CL folder. 同时复制C:/Program Files (x86)/AMD APP SDK/2.9-1/libx86_64文件夹,并将其粘贴到与CL文件夹相同的目录中。
  3. Unzip the folder pyopencl.zip and go to (location of pyopencl)/src/wrapper 解压缩文件夹pyopencl.zip并转到(location of pyopencl)/src/wrapper
  4. Inside the wrapper folder, open the file wrap_cl.hpp . wrapper文件夹中,打开文件wrap_cl.hpp
  5. Change the #include <CL/cl.h> to #include <cl.h> #include <CL/cl.h>更改为#include <cl.h>
  6. Next go to the CL that you copied in the first step and open the file cl_platform.h . 接下来转到您在第一步中复制的CL并打开文件cl_platform.h Repeat step 5 once more. 再次重复步骤5。
  7. Next find the cl_ext.h file inside the CL folder and open it. 接下来找到CL文件夹中的cl_ext.h文件并将其打开。 Repeat step 5 again. 再次重复步骤5。
  8. Inside a cmd window in admin mode, go to the directory of pyopencl and run the command python configure.py . admin模式下的cmd窗口内,转到pyopencl目录并运行命令python configure.py This will generate a siteconf.py file that will hold some parameters for installation. 这将生成一个siteconf.py文件,该文件将包含一些安装参数。
  9. Open the siteconf.py file and replace the CL_INC_DIR = [] with CL_INC_DIR = [r'(path to the new location of the CL folder)'] and replace CL_LIB_DIR = [] with CL_LIB_DIR = [r'(path to the new location of the x86_64 folder)'] . 打开siteconf.py文件并将CL_INC_DIR = []替换为CL_INC_DIR = [] CL_INC_DIR = [r'(path to the new location of the CL folder)']并用CL_LIB_DIR = [r'(path to the new location of the x86_64 folder)']替换CL_LIB_DIR = [] CL_LIB_DIR = [r'(path to the new location of the x86_64 folder)']
  10. Finally in cmd , run python setup.py install from the pyopencl directory and enjoy. 最后在cmd ,从pyopencl目录运行python setup.py install并享受。

Hope this solution helps you during the installation of PyOpenCL in Windows 8 (x64). 希望此解决方案可以帮助您在Windows 8(x64)中安装PyOpenCL Any other suggestions are welcome. 欢迎任何其他建议。

After 2 days of tries and errors I made it. 经过2天的尝试和错误,我做到了。 PyOpenCL is installed. PyOpenCL已安装。 Here is my hardware: 这是我的硬件:

ATI Radeon 7970 with installed Catalyst and most import: INSTALLED AMD APP SDK (2.9.1) ATI Radeon 7970已安装Catalyst且大部分已导入:安装的AMD APP SDK(2.9.1)

Software installed before starting with PyOpenCL: 在使用PyOpenCL开始之前安装的软件:

1. Python 2.7.9 (x86) 1. Python 2.7.9(x86)

2. Numpy (x86) 2. Numpy(x86)

3. pywin32 3. pywin32

4. Visual Studio 2008 4. Visual Studio 2008

5. Mako ( -> easy_install Mako ) 5. Mako( - > easy_install Mako)

6. Boost 6.提升

The most important step according to me is the getting the SITECONF.py file right. 根据我的说法,最重要的一步是获取SITECONF.py文件。 To get it: 为拿到它,为实现它:

Run "python configure.py" in the pyopencl directory to get a sample siteconfig.py. 在pyopencl目录中运行“python configure.py”以获取示例siteconfig.py。

Here is my file after modification. 这是我修改后的文件。 Please note that if you wanna use nVidia, CL_INC_DIR = [] and CL_LIB_DIR = [] are going to be different and perhaps look something like this: 请注意,如果你想使用nVidia,CL_INC_DIR = []和CL_LIB_DIR = []会有所不同,或许看起来像这样:

CL_INC_DIR = [r'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v4.1\\include'] CL_INC_DIR = [r'C:\\ Program Files \\ NVIDIA GPU Computing Toolkit \\ CUDA \\ v4.1 \\ include']

CL_LIB_DIR = [r'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v4.1\\lib\\x64'] CL_LIB_DIR = [r'C:\\ Program Files \\ NVIDIA GPU Computing Toolkit \\ CUDA \\ v4.1 \\ lib \\ x64']

So, my siteconf.py file: 那么,我的siteconf.py文件:

  BOOST_INC_DIR = [r'C:\C++ Projects\boost_1_55_0']
  BOOST_LIB_DIR = [r'C:\C++ Projects\boost_1_55_0\stage\lib']
  BOOST_COMPILER = 'gcc43'
  BOOST_PYTHON_LIBNAME = ['boost_python']
  USE_SHIPPED_BOOST = True
  CL_TRACE = False
  CL_ENABLE_GL = True
  CL_ENABLE_DEVICE_FISSION = True
  CL_INC_DIR = [r'C:\Program Files (x86)\AMD APP SDK\2.9-1\include']
  CL_LIB_DIR = [r'C:\Program Files (x86)\AMD APP SDK\2.9-1\lib\x86_64']
  CL_LIBNAME = ['OpenCL']
  CXXFLAGS = ['/EHsc']
  LDFLAGS = ['/FORCE']

You can find many examples online where the Microsoft SDK is also put in CL_INC_DIR = [] and CL_LIB_DIR = [] , however I don't intend to use OpenCL on my i3 processor, so did not build the pyopencl with the MS files. 您可以在线找到许多示例,其中Microsoft SDK也放在CL_INC_DIR = []和CL_LIB_DIR = []中,但是我不打算在我的i3处理器上使用OpenCL,因此没有使用MS文件构建pyopencl。 I hope this was helpful! 我希望这可以帮到你! And the dreamed result: 而梦想的结果是:

>>> import pyopencl as cl >>>将pyopencl导入为cl

>>> >>>

After making changes above, when executing: 在进行上述更改后,执行时:

python setup.py install

I am getting this error: 我收到此错误:

building 'pyopencl._cl' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX64\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -DHAVE_GL=1 -IH:\pyopencl-2018.2\CL -Ipybind11/include -IC:\Users\James\Anaconda3\Include -IC:\Users\James\AppData\Roaming\Python\Python35\Include -IC:\Users\James\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\James\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\James\Anaconda3\lib\site-packages\numpy\core\include -IC:\Users\James\Anaconda3\include -IC:\Users\James\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /EHsc /Tpsrc/wrap_constants.cpp /Fobuild\temp.win-amd64-3.5\Release\src/wrap_constants.obj /EHsc /DVERSION_INFO=\"2018.2\"
wrap_constants.cpp
h:\pyopencl-2018.2\src\wrap_helpers.hpp(5): fatal error C1083: Cannot open include file: 'pybind11-2.2.4-py3.5.egg/pybind11.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2

What path do I change wrap_helpers.hpp for: 我更改wrap_helpers.hpp的路径是什么:

#include <pybind11.h>
#include <operators.h>

@James, I got the same problem as you did. @James,我遇到了和你一样的问题。 Here is what I' ve done to get throught it. 以下是我为完成它所做的工作。

1. run pip install pybind11
2. add the "PythonInstallPath/include/pybind11" in the right place within 
  the wrap_helpers.hpp file.
3. go back to pyopencl directory, and run pip setup.py install.

finnally, I got pyopencl. 最后,我得到了pyopencl。 Hope this helps. 希望这可以帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在安装了 Windows C++ 构建工具的 Visual Studio 中找不到 CL/cl.h 文件 - CL/cl.h file not found Visual Studio with Windows C++ build tools installed 在 Windows x64 中运行 Cython - 致命错误 C1083:无法打开包含文件:&#39;basetsd.h&#39;:没有这样的文件或目录 - Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory 出现错误“错误:命令&#39;cl.exe&#39;失败:没有这样的文件或目录” - Have an error “ error: command 'cl.exe' failed: No such file or directory” 错误:C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe ' 退出失败 - ERROR: C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit 错误:命令“cl.exe”失败:VScode 上没有这样的文件或目录 - Error: command 'cl.exe' failed: No such file or directory on VScode 错误:命令“ cl.exe”失败:没有这样的文件或目录 - error: command 'cl.exe' failed: No such file or directory 在 Python/PIP 中安装 REBOUND 时出错:…Microsoft Visual Studio\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 - Error with installing REBOUND in Python/PIP: …Microsoft Visual Studio\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 在mac os中安装pyopencl时出错 - Error during installation of pyopencl in mac os 在Windows x64上安装libpng时出错 - Error in installing libpng for windows x64 致命错误:Python.h:没有此类文件或目录错误:命令“ x86_64-linux-gnu-gcc”失败,退出状态为1 - fatal error: Python.h: No such file or directory error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM