PyOpenCL cannot use cuda-10.1/lib64/

I freshly installed system (Ubuntu 18.04) on new computer with RTX2060 GPU

But when I run pyOpenCL program I got following Erorr:

Traceback (most recent call last):
  File "../..//pyProbeParticle/", line 25, in <module>
    import pyopencl     as cl
  File "/usr/lib/python2.7/dist-packages/pyopencl/", line 37, in <module>
    import pyopencl.cffi_cl as _cl
  File "/usr/lib/python2.7/dist-packages/pyopencl/", line 39, in <module>
    from pyopencl._cffi import ffi as _ffi
ImportError: /usr/local/cuda-10.1/lib64/ version `OPENCL_2.1' not found (required by /usr/lib/python2.7/dist-packages/pyopencl/

For some reason pyOpenCL insist to use OPENCL_2.1' while the GPU provide only OpenCL 1.2`

This is strange because I run this program without any problem on much older nVidia GeForce GTX 960 GPU in my laptop without any problem.

I think it’s probably expected behavior that NVIDIA OpenCL implementation publishes 1.2 compatiblity.

It may be that a different compatibility level was published on different CUDA versions (don’t know if the CUDA version on your laptop is 10.1) and/or even for different GPUs.

It may even be that you have differently-compiled versions of pyOpenCL in the two machines. It may be possible to build pyOpenCL to only use OpenCL 1.2:


NVIDIA GPUs implement OpenCL 1.2 with some functionality from OpenCL 2.0 also available, as well as some NVIDIA extensions.

Thanks for reply

I did not managed to compile pyOpenCL due to some errors with pybind.

But I tried to install pyopencl 2019.1.1 from pip ( pyopencl · PyPI ) and this solved the problem.

The pyOpenCl in Ubuntu 18.04 repository is quite old ( 2017.2.2-1 ) so that was perhaps the problem.

I also tried to run some prorgams with pure C/C++ binding OpenCL and it all works fine.

On the other hand I’m quite disapointed by performance of this RTX2060 in OpenCL, it is just 2x faster than GeForce GTX 960, and for some mysterious reason nominaly much weaker AMD Radeon
R7 360 is 5x faster (but that is another topic, possibly I do something wrong).