PyOpenCL in Ubuntu repositories

Ubuntu Maverick Meerkat (10.10) and later contain PyOpenCL packages for architectures amd64 and i386 in multiverse. Package is called python-pyopencl and depends on NVIDIA drivers.

apt-get install python-pyopencl


apt-get install python3-pyopencl

Additional Notes (Dell Inspiron laptop with Intel and Nvidia cards)

I am using Ubuntu 12.04 on a Dell Inspiron laptop. I needed to install bumblebee in order to use the Nvidia graphics card. In order to run tests, I needed to do

optirun python examples/

which gave me the error

clRetainDevice, version OPENCL_1.2 not defined in file

It turns out optirun redefines my LD_LIBRARY_PATH so now I pick up from /usr/lib/nvidia-current/ where I want the one from /usr/lib/x86_64-linux-gnu/ Once I moved it, for example with

#mv /usr/lib/nvidia-current/{,.1}

running the benchmark (under optirun, don't forget) gave me

clGetPlatformIDs failed: platform not found khr

which was solved by

#echo >> /etc/OpenCL/vendors/nvidia.icd