Search code examples
pythonubuntupyopencl

PyOpenCL can't build the program in Ubuntu


I'm trying to use PyOpenCL via SSH on Ubuntu, but when I get in the "prg = cl.Program(ctx, kernel).build()" it returns

`Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 141, in build
    options = options + ["-I", _find_pyopencl_include_path()]
  File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 722, in _find_pyopencl_include_path
    from pkg_resources import Requirement, resource_filename
ImportError: No module named pkg_resources`

The program I'm trying to build is the oficial from PyOpenCL documentation (https://documen.tician.de/pyopencl/index.html).


Solution

  • You just have to install the python-pkg-resources package, which provides the python package called "pkg_resources".

    For other distributions, the setuptools for python package might be needed.