Skip to content

NumPy 2.0 support #37

@fox91

Description

@fox91

I'm trying to install titanlib on python3.9:

$ python3 -m venv ENV
$ source ENV/bin/activate

$ python3 --version
Python 3.9.21

$ pip install --upgrade pip setuptools wheel
Requirement already satisfied: pip in ./ENV/lib/python3.9/site-packages (23.0.1)
Collecting pip
  Using cached pip-25.0.1-py3-none-any.whl (1.8 MB)
Requirement already satisfied: setuptools in ./ENV/lib/python3.9/site-packages (58.1.0)
Collecting setuptools
  Using cached setuptools-75.8.0-py3-none-any.whl (1.2 MB)
Collecting wheel
  Using cached wheel-0.45.1-py3-none-any.whl (72 kB)
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: setuptools
    Found existing installation: setuptools 58.1.0
    Uninstalling setuptools-58.1.0:
      Successfully uninstalled setuptools-58.1.0
  Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
      Successfully uninstalled pip-23.0.1
Successfully installed pip-25.0.1 setuptools-75.8.0 wheel-0.45.1

$ pip install --upgrade titanlib
Collecting titanlib
  Using cached titanlib-0.3.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.metadata (1.2 kB)
Collecting numpy>=1.16 (from titanlib)
  Using cached numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)
Using cached titanlib-0.3.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (5.3 MB)
Using cached numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 MB)
Installing collected packages: numpy, titanlib
Successfully installed numpy-2.0.2 titanlib-0.3.3

$ python3
Python 3.9.21 (main, Feb  4 2025, 07:26:16) 
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import titanlib

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.2 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 "/tmp/ENV/lib/python3.9/site-packages/titanlib.py", line 15, in <module>
    import _titanlib
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/ENV/lib/python3.9/site-packages/titanlib.py", line 15, in <module>
    import _titanlib
ImportError: numpy.core.multiarray failed to import
>>>

I see that in the last few days this change has been made to the code (I don't know if it would solve my problem) but there hasn't been a new release.

In any case, would forcing the use of the old version be a temporary solution?
NumPy 2.0 has been released almost a year, there have been no more NumPy 1.x releases and I don't think there will be any more.

Are there any plans to add NumPy 2.x support?
I ask this also because there have been no more releases of titanlib since 2022 and I would like to understand if the development is still active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions