0

Does anybody has a clue, why this command leads to this error? I am trying to install that on a Windows10 machine with a NVIDIA GPU and CUDA and Python 2.7.14 installed.

The DOS command:

python -m pip install pyopencl

The Output / Error:

Collecting pyopencl Using cached pyopencl-2017.2.tar.gz Requirement already satisfied: numpy in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: pytools>=2017.2 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: pytest>=2 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: decorator>=3.2.0 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: cffi>=1.1.0 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: appdirs>=1.4.0 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: six>=1.9.0 in c:\python27\lib\site-packages (from pyopencl) Requirement already satisfied: py>=1.5.0 in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: attrs>=17.2.0 in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: pluggy<0.7,>=0.5 in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: funcsigs; python_version < "3.0" in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pytest>=2->pyopencl) Requirement already satisfied: pycparser in c:\python27\lib\site-packages (from cffi>=1.1.0->pyopencl) Installing collected packages: pyopencl
Running setup.py install for pyopencl ... error Complete output from command C:\Python27\python.exe -u -c "import setuptools, tokenize;file='c:\users\USERA\appdata\local\temp\pip-build-6sqhas\pyopencl\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\USERA\appdata\local\temp\pip-jcsz8t-record\install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build\lib.win-amd64-2.7 creating build\lib.win-amd64-2.7\pyopencl copying pyopencl\algorithm.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\array.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\bitonic_sort.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\bitonic_sort_templates.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\cache.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\capture_call.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\cffi_cl.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\clmath.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\clrandom.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\cltypes.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\elementwise.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\invoker.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\ipython_ext.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\mempool.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\reduction.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\scan.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\tools.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl\version.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl_buffers.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl_cluda.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl_mymako.py -> build\lib.win-amd64-2.7\pyopencl copying pyopencl__init__.py -> build\lib.win-amd64-2.7\pyopencl creating build\lib.win-amd64-2.7\pyopencl\characterize copying pyopencl\characterize\performance.py -> build\lib.win-amd64-2.7\pyopencl\characterize copying pyopencl\characterize__init__.py -> build\lib.win-amd64-2.7\pyopencl\characterize creating build\lib.win-amd64-2.7\pyopencl\compyte copying pyopencl\compyte\array.py -> build\lib.win-amd64-2.7\pyopencl\compyte copying pyopencl\compyte\dtypes.py -> build\lib.win-amd64-2.7\pyopencl\compyte copying pyopencl\compyte__init__.py -> build\lib.win-amd64-2.7\pyopencl\compyte creating build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray\gen_elemwise.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray\gen_reduction.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray\setup_opencl.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray\test_gpu_elemwise.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray\test_gpu_ndarray.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray copying pyopencl\compyte\ndarray__init__.py -> build\lib.win-amd64-2.7\pyopencl\compyte\ndarray running egg_info writing requirements to pyopencl.egg-info\requires.txt writing pyopencl.egg-info\PKG-INFO writing top-level names to pyopencl.egg-info\top_level.txt writing dependency_links to pyopencl.egg-info\dependency_links.txt warning: manifest_maker: standard file '-c' not found

reading manifest file 'pyopencl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'src\c_wrapper\*.hpp'
warning: no files found matching 'doc\_static\*.css'
warning: no files found matching 'doc\_templates\*.html'
writing manifest file 'pyopencl.egg-info\SOURCES.txt'
creating build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-airy.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j-complex.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-y.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-complex.h -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-eval-tbl.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-hankel-complex.cl -> build\lib.win-amd64-2.7\pyopencl\cl
copying pyopencl\cl\pyopencl-ranluxcl.cl -> build\lib.win-amd64-2.7\pyopencl\cl
creating build\lib.win-amd64-2.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\array.h -> build\lib.win-amd64-2.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\openclfeatures.h -> build\lib.win-amd64-2.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\philox.cl -> build\lib.win-amd64-2.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\threefry.cl -> build\lib.win-amd64-2.7\pyopencl\cl\pyopencl-random123
running build_ext
generating cffi module 'build\\temp.win-amd64-2.7\\Release\\pyopencl._cffi.cpp'
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
building 'pyopencl._cffi' extension
creating build\temp.win-amd64-2.7\Release\build
creating build\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\src
creating build\temp.win-amd64-2.7\Release\src\c_wrapper
C:\Users\USERA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS-

/DNDEBUG -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -DPYOPENCL_USE_SHIPPED_EXT=1 -Isrc/c_wrapper/ -IC:\Python27\include -IC:\Python27\PC /Tpbuild\temp.win-amd64-2.7\Release\pyopencl._cffi.cpp /Fobuild\temp.win-amd64-2.7\Release\build\temp.win-amd64-2.7\Release\pyopencl._cffi.obj -std=gnu++11 cl : Command line warning D9002 : ignoring unknown option '-std=gnu++11' pyopencl._cffi.cpp C:\Users\USERA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\stdint.h(82) : error C2371: 'int8_t' : redefinition; different basic types build\temp.win-amd64-2.7\Release\pyopencl._cffi.cpp(211) : see declaration of 'int8_t' c:\users\USERA\appdata\local\temp\pip-build-6sqhas\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\USERA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2

---------------------------------------- Command "C:\Python27\python.exe -u -c "import setuptools,

tokenize;file='c:\users\USERA\appdata\local\temp\pip-build-6sqhas\pyopencl\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\USERA\appdata\local\temp\pip-jcsz8t-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\USERA\appdata\local\temp\pip-build-6sqhas\pyopencl\

Robert Crovella
  • 143,785
  • 11
  • 213
  • 257

3 Answers3

1

This part of the log:

Cannot open include file: 'CL/cl.h': No such file or directory error

tells me the OpenCL headers are missing. You should install an appropriate SDK. Since you have an NVidia, I suggest you look in here.

gmagno
  • 1,770
  • 1
  • 19
  • 40
1

This answer in this post may help. Check out my answer there. Basically, the installation is done by installing the correct version of WHL file for your system.

Harry
  • 1,147
  • 13
  • 13
0

I have been this road with cuda (cupy) opencl (pyopencl) and vulkan (kompute). There are 4 things to get them work.

  • Driver installation read documentation (amd-gpu , nvidia)
  • Framework installation without or within SDK , with or without tools (cuda+cuda toolkit,rocm,opencl,vulkan,vulkan-utilities)
  • python package - wrapper installation (cupy,pyopencl,kompute)
  • avoiding version mismatch and adjusting env variables.

All these have dependencies , environment variables and additions to PATH. While installing these needs to find each others locations so that gcc or packages or configuration files can link to them.

The most straightforward way is to look at documentation and follow the steps for an OS - for a framework and driver version.

And if something does not work , revert back and correct what it is wrong.

In your case:

 fatal error C1083: Cannot open include file: 'CL/cl.h': No such file or directory error: command 

There seems to be either opencl headers and cpp files or a PATH variable missing.

Second error is :

C:\Users\USERA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\stdint.h(82) : error C2371: 'int8_t' : redefinition; different basic types build\temp.win-amd64-2.7\Release\pyopencl._cffi.cpp(211) : see declaration of 'int8_t'

In visual C++ for python 9.0 in line 82 there is a redefinition of int8_t basic type which is declared and defined first as int8_t in pyopencl.cffi.cpp which is build temp.

I guess there is an #ifndef int8_t missing not to redefine it ...

As a final advice. Use latest stable versions of OS - driver - framework - python package from an installation guide.

For example I don't know why you use python 2.7 instead of python 3.9+

I am on latest archlinux with python 3.10.2 and everything both AMD and Nvidia both opencl cuda opengl vulkan-compute works ...

Gediz GÜRSU
  • 555
  • 4
  • 12