5

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\
Maryam Farabi
  • 51
  • 1
  • 1
  • 4

3 Answers3

8

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.

tzengia
  • 352
  • 5
  • 12
  • 1
    This worked for me. Thanks! However with python3 and I used CUDA toolkit 10.2. – j.karlsson May 22 '20 at 20:58
  • Confirmed to work. Win10 x64, AMD RX series GPU, Python 3.9. – user180977 Jul 25 '21 at 04:07
  • Thanks a lot.. It worked on my device which has a Vega 8 GPU – Gulshan Mishra Aug 10 '21 at 14:19
  • For reference, this worked for me with python3 and CUDA toolkit 11.5 pip3 install --global-option=build_ext --global-option="-Ic:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\include" --global-option="-Lc:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.5\lib\x64" pyopencl – Han Nov 28 '21 at 18:54
6

Seems you don't have any OpenCL SDK installed.

There are different SDK from different providers:

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).

Andrey Kolpakov
  • 446
  • 4
  • 7
  • I installed cuda nvidia toolkit, I am trying to do pip install pyopencl .. still getting this error. Any thoughts? – ScipioAfricanus Sep 04 '19 at 13:03
  • Works fine for me, except that the path is a different one. Here I need to use `set INCLUDE="C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\include/"` and `set LIB="C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\lib\x64\"` (the latter is for finding OpenCL.lib). – scai Nov 16 '21 at 12:49
0

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
Harry
  • 1,147
  • 13
  • 13