TREX-CoE/trexio

Installation on aarch64 (13.2.1 and M2)

Closed this issue ยท 3 comments

Hi @q-posev I saw that you've started working on supporting aarch64.
I have a mac mini m2 with 13.2.1 and I tried, following your recipe, to install the python API.

The compilation and checks for trexio succeded so did the installation of the python API.
However, import trexio failed with the following message:

Successfully installed numpy-2.0.0 trexio-2.5.0
+ rm -rf build dist trexio.egg-info
(trex) chilkuri@vijays-Mac-mini trexio % python
iPython 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import trexio

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 "/Users/chilkuri/anaconda3/envs/trex/lib/python3.11/site-packages/trexio.py", line 14, in <module>
    import pytrexio.pytrexio as pytr
  File "/Users/chilkuri/anaconda3/envs/trex/lib/python3.11/site-packages/pytrexio/pytrexio.py", line 10, in <module>
    from . import _pytrexio
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
  File "/Users/chilkuri/anaconda3/envs/trex/lib/python3.11/site-packages/trexio.py", line 14, in <module>
    import pytrexio.pytrexio as pytr
  File "/Users/chilkuri/anaconda3/envs/trex/lib/python3.11/site-packages/pytrexio/pytrexio.py", line 10, in <module>
    from . import _pytrexio
ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chilkuri/anaconda3/envs/trex/lib/python3.11/site-packages/trexio.py", line 16, in <module>
    raise Exception("Could not import pytrexio module from trexio package")
Exception: Could not import pytrexio module from trexio package

Looks like a numpy compatibility error. Have you run across this before ?
I'll try to debug a little further to check what's going on.

I'm using trexio-master: 92504e0

Thanks !

Hi @v1j4y ,

Good catch. Indeed, TREXIO compatibility with NumPy API 2.0 has not been tested and I do not have time to investigate that right now. There are many packages that report this error nowadays because NumPy 2.0 got officially deployed. It's going to be a big mess :-)

In requirements.txt we still have numpy<1.27.0 so if you just downgrade NumPy to < 2.0 - this error should disappear. That's the best solution for now.

That solved the issue !

Here are the steps to revolve the issue:

conda install -c conda-forge numpy=1.26.0

That's it !
Now import trexio succeeds !
Amazing that I can now use trexio on my mac m2 ๐Ÿ‘

(trex) chilkuri@vijays-Mac-mini trexio % python
Python 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.26.0'
>>> 
(trex) chilkuri@vijays-Mac-mini trexio % python
Python 3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import trexio
>>> 

@v1j4y I got the CI working on macos@arm64 so next TREXIO release should include the pre-compiled Python wheels for this arch so pip install trexio should work on new Macs with ARM chips. Stay tuned !