inducer / pyopencl

OpenCL integration for Python, plus shiny features
http://mathema.tician.de/software/pyopencl
Other
1.04k stars 237 forks source link

Wheels built with numpy2 #769

Closed t20100 closed 1 week ago

t20100 commented 2 weeks ago

Describe the bug

Wheels currently available in pypi (2024.2.6) are not compatible with numpy v2. It would be great to have wheels with numpy 2 support since it has been released.

To Reproduce Steps to reproduce the behavior:

  1. Install numpy v2 and pyopencl 2024.2.6 from a wheel
  2. Run import pyopencl
  3. See exception: ImportError: ImportError: numpy.core.multiarray failed to import
>>> import pyopencl

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "<stdin>", line 1, in <module>
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/__init__.py", line 29, in <module>
    import pyopencl.cltypes  # noqa: F401
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/cltypes.py", line 25, in <module>
    from pyopencl.tools import get_or_register_dtype
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/tools.py", line 138, in <module>
    from pyopencl._cl import bitlog2, get_cl_header_version  # noqa: F401
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/__init__.py", line 29, in <module>
    import pyopencl.cltypes  # noqa: F401
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/cltypes.py", line 25, in <module>
    from pyopencl.tools import get_or_register_dtype
  File "/envs/py310/lib/python3.10/site-packages/pyopencl/tools.py", line 138, in <module>
    from pyopencl._cl import bitlog2, get_cl_header_version  # noqa: F401
ImportError: ImportError: numpy.core.multiarray failed to import

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

jorektheglitch commented 1 week ago

Same problem. Is there any temporary workaround before stable release?

t20100 commented 1 week ago

Installing "numpy<2" is an easy fix.

inducer commented 1 week ago

https://github.com/inducer/pyopencl/releases/tag/v2024.2.7 should address this. It should be on the package index soon.