Error while installing pyopencl on Windows 10

Hello all,

I am trying to install gputools pip install gputools to run stardist using the GPU (NVIDIA Geforce RTX 2070).

I get a big error message when it tries to install pyopencl. I’ll post the full error message at the end of the post, since it’s quite the big one. I think the main problems are written here

C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\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\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2 *---------------------------------------- ERROR: Failed building wheel for pyopencl

sidenote: the * after “exit status 2” was added to stop the text getting bold and bigger font

The NVIDIA Drivers are up to date. We have installed CUDA toolkit v10 cuDNN v7

I have tried to install pyopencl by following this guide - https://wiki.tiker.net/PyOpenCL/Installation/Windows/#windows-10-64-bit-python-38-pyopencl-201912-visual-studio-2015-update-3-community-edition-nvidia-cuda-102

However, by the end of it, I get the same error message. I do not know how to proceed from here.

Thanks in advance for your help.

Best regards,
José Marques

Full error message

`C:\Users\igcuser>pip install gputools
Collecting gputools
Using cached gputools-0.2.9-py3-none-any.whl (152 kB)
Requirement already satisfied: configparser in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from gputools) (5.0.0)
Requirement already satisfied: scikit-tensor-py3; python_version >= “3.0” in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from gputools) (0.4.1)
Collecting pyopencl>=2016.1
Using cached pyopencl-2020.2.2.tar.gz (352 kB)
Requirement already satisfied: numpy>=1.11.0 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from gputools) (1.16.4)
Requirement already satisfied: scipy in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from gputools) (1.3.0)
Requirement already satisfied: reikna>=0.6.7 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from gputools) (0.7.5)
Requirement already satisfied: pytools>=2017.6 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from pyopencl>=2016.1->gputools) (2020.4)
Requirement already satisfied: decorator>=3.2.0 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from pyopencl>=2016.1->gputools) (4.4.2)
Requirement already satisfied: appdirs>=1.4.0 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from pyopencl>=2016.1->gputools) (1.4.4)
Requirement already satisfied: funcsigs>=0.3 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from reikna>=0.6.7->gputools) (1.0.2)
Requirement already satisfied: mako>=0.8.0 in c:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages (from reikna>=0.6.7->gputools) (1.1.3)
Requirement already satisfied: six>=1.8.0 in c:\users\igcuser\appdata\roaming\python\python37\site-packages (from pytools>=2017.6->pyopencl>=2016.1->gputools) (1.15.0)
Requirement already satisfied: MarkupSafe>=0.9.2 in c:\users\igcuser\appdata\roaming\python\python37\site-packages (from mako>=0.8.0->reikna>=0.6.7->gputools) (1.1.1)
Building wheels for collected packages: pyopencl
Building wheel for pyopencl (setup.py) … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\igcuser\appdata\local\programs\python\python37\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl\setup.py’"’"’; file=’"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl\setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ bdist_wheel -d ‘C:\Users\igcuser\AppData\Local\Temp\pip-wheel-6gd94bbo’
cwd: C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl
Complete output (76 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyopencl
copying pyopencl\algorithm.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\array.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\bitonic_sort.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\bitonic_sort_templates.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\cache.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\capture_call.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\clmath.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\clrandom.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\cltypes.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\elementwise.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\invoker.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\ipython_ext.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\reduction.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\scan.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\tools.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\version.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_cluda.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_mymako.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_init_.py -> build\lib.win-amd64-3.7\pyopencl
creating build\lib.win-amd64-3.7\pyopencl\characterize
copying pyopencl\characterize\performance.py -> build\lib.win-amd64-3.7\pyopencl\characterize
copying pyopencl\characterize_init_.py -> build\lib.win-amd64-3.7\pyopencl\characterize
creating build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte\array.py -> build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte\dtypes.py -> build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte_init_.py -> build\lib.win-amd64-3.7\pyopencl\compyte
creating build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_elemwise.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_reduction.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\setup_opencl.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_elemwise.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_ndarray.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray_init_.py -> build\lib.win-amd64-3.7\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’
warning: no files found matching ‘pyproject.toml’
writing manifest file ‘pyopencl.egg-info\SOURCES.txt’
creating build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-airy.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j-complex.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-y.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-complex.h -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-eval-tbl.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-hankel-complex.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-ranluxcl.cl -> build\lib.win-amd64-3.7\pyopencl\cl
creating build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\array.h -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\openclfeatures.h -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\philox.cl -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\threefry.cl -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
running build_ext
building ‘pyopencl._cl’ extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -Ipybind11/include -Ic:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages\pybind11\include -Ic:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages\numpy\core\include -Ic:\users\igcuser\appdata\local\programs\python\python37\include -Ic:\users\igcuser\appdata\local\programs\python\python37\include “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt” /EHsc /Tpsrc/wrap_constants.cpp /Fobuild\temp.win-amd64-3.7\Release\src/wrap_constants.obj -fvisibility=hidden /EHsc /DVERSION_INFO=“2020.2.2”
cl : Command line warning D9002 : ignoring unknown option ‘-fvisibility=hidden’
wrap_constants.cpp
C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\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\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe’ failed with exit status 2

ERROR: Failed building wheel for pyopencl
Running setup.py clean for pyopencl
Failed to build pyopencl
Installing collected packages: pyopencl, gputools
Running setup.py install for pyopencl … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\igcuser\appdata\local\programs\python\python37\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl\setup.py’"’"’; file=’"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\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\igcuser\AppData\Local\Temp\pip-record-7u5fupsy\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\users\igcuser\appdata\local\programs\python\python37\Include\pyopencl’
cwd: C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl
Complete output (76 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\pyopencl
copying pyopencl\algorithm.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\array.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\bitonic_sort.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\bitonic_sort_templates.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\cache.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\capture_call.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\clmath.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\clrandom.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\cltypes.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\elementwise.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\invoker.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\ipython_ext.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\reduction.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\scan.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\tools.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl\version.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_cluda.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_mymako.py -> build\lib.win-amd64-3.7\pyopencl
copying pyopencl_init_.py -> build\lib.win-amd64-3.7\pyopencl
creating build\lib.win-amd64-3.7\pyopencl\characterize
copying pyopencl\characterize\performance.py -> build\lib.win-amd64-3.7\pyopencl\characterize
copying pyopencl\characterize_init_.py -> build\lib.win-amd64-3.7\pyopencl\characterize
creating build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte\array.py -> build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte\dtypes.py -> build\lib.win-amd64-3.7\pyopencl\compyte
copying pyopencl\compyte_init_.py -> build\lib.win-amd64-3.7\pyopencl\compyte
creating build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_elemwise.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\gen_reduction.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\setup_opencl.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_elemwise.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray\test_gpu_ndarray.py -> build\lib.win-amd64-3.7\pyopencl\compyte\ndarray
copying pyopencl\compyte\ndarray_init_.py -> build\lib.win-amd64-3.7\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’
warning: no files found matching ‘pyproject.toml’
writing manifest file ‘pyopencl.egg-info\SOURCES.txt’
creating build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-airy.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j-complex.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-j.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-bessel-y.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-complex.h -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-eval-tbl.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-hankel-complex.cl -> build\lib.win-amd64-3.7\pyopencl\cl
copying pyopencl\cl\pyopencl-ranluxcl.cl -> build\lib.win-amd64-3.7\pyopencl\cl
creating build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\array.h -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\openclfeatures.h -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\philox.cl -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
copying pyopencl\cl\pyopencl-random123\threefry.cl -> build\lib.win-amd64-3.7\pyopencl\cl\pyopencl-random123
running build_ext
building ‘pyopencl._cl’ extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DPYGPU_PACKAGE=pyopencl -DPYGPU_PYOPENCL=1 -Ipybind11/include -Ic:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages\pybind11\include -Ic:\users\igcuser\appdata\local\programs\python\python37\lib\site-packages\numpy\core\include -Ic:\users\igcuser\appdata\local\programs\python\python37\include -Ic:\users\igcuser\appdata\local\programs\python\python37\include “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include” “-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include” “-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt” /EHsc /Tpsrc/wrap_constants.cpp /Fobuild\temp.win-amd64-3.7\Release\src/wrap_constants.obj -fvisibility=hidden /EHsc /DVERSION_INFO=“2020.2.2”
cl : Command line warning D9002 : ignoring unknown option ‘-fvisibility=hidden’
wrap_constants.cpp
C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\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\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe’ failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: ‘c:\users\igcuser\appdata\local\programs\python\python37\python.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\pyopencl\setup.py’"’"’; file=’"’"‘C:\Users\igcuser\AppData\Local\Temp\pip-install-0qiit0f4\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\igcuser\AppData\Local\Temp\pip-record-7u5fupsy\install-record.txt’ --single-version-externally-managed --compile --install-headers ‘c:\users\igcuser\appdata\local\programs\python\python37\Include\pyopencl’ Check the logs for full command output.

C:\Users\igcuser>`

Try to install pyopencl using pre-compiled wheels before pip installing gputools.

3 Likes

Hi,

Indeed installing pyopencl on Windows can be sometimes tricky. I would follow @cgohlke’s advice (trying it with wheels). Please let me know if and what works for you and we might add that to the documentation (PR are welcome ;).

1 Like

Hello,

I followed @cgohlke instructions and managed to install gputools. I downloaded this version (pyopencl‑2020.2.2+cl12‑cp37‑cp37m‑win_amd64.whl)
Unzipped its contents (2 folders: pyopencl and pyopencl-2020.2.2+cl12.dist-info) and inserted them at C:\Users\igcuser\AppData\Local\Programs\Python\Python37\Lib\site-packages

Afterward, called pip install gputools and voilà, gputools installed

Thank you very much for your help. Now the next step is to verify if tensorflow can access the GPU.

Best,
José Marques

1 Like