To install pyopencl on a Windows system:
- Find out what Python version you are using.
- Go to this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl and download the whl file for your python version. E.g., I tested this install method using a Python 3.7.9 (64bit) environment, so I downloaded the file
pyopencl‑2020.3.1+cl12‑cp37‑cp37m‑win_amd64.whl
(PyOpenCL version 2020.3.1, OpenCL version 1.2, Python version 3.7, 64bit). Note that there are two OpenCL versions, 1.2 and 2.1 (i.e.,cl12
andcl21
). Start by trying to install thecl12
version first, and if that fails, uninstall pyopencl and then install thecl21
version. - Install the
whl
file using:pip install <wheel_file_name>
, e.g.,pip install pyopencl‑2020.3.1+cl12‑cp37‑cp37m‑win_amd64.whl
- Test the installation by starting
python
, then doing:
import pyopencl as cl
print(cl.get_platforms())
- You should see something like:
[<pyopencl.Platform 'AMD' at 0x11234567890>]
- If you need to, to uninstall
pyopencl
from your Python environment, dopip uninstall pyopencl