dftlibs / numgrid

Numerical integration grid for molecules.
Mozilla Public License 2.0
47 stars 14 forks source link

AssertionError when importing on M1 Mac (installed from pip) #48

Open gayverjr opened 2 years ago

gayverjr commented 2 years ago

Hello, I pip installed numgrid in an ARM python 3.9.10 environment without any errors, however I receive the following error when I try to import the module:

import numgrid

Traceback (most recent call last): File "", line 1, in File "/Users/jamesrgayvert/miniforge3/lib/python3.9/site-packages/numgrid/init.py", line 44, in assert _header_file is not None

Everything works totally fine if I install and run in a Rosetta2 environment, so there's something ARM specific happening here.

bast commented 2 years ago

The error message looks like that in the ARM environment it does not find a matching binary distribution and falls back to a super old source distribution. The error that you see comes from a old version of Numgrid and the corresponding code that throws that error has already been removed.

What I need to find out how to do is how to build a binary distribution for the ARM environment. This is macOS, right?

bast commented 2 years ago

Oh the issue title says it's M1 Mac. OK I need to learn how to package a binary distribution for the M1.

bast commented 2 years ago

I need to adapt this somehow: https://github.com/dftlibs/numgrid/blob/main/.github/workflows/package.yml#L13

bast commented 2 years ago

I am unsure whether this is possible on GitHub Actions: https://github.com/actions/virtual-environments/issues/2187

But one thing I can do is to describe how you could build the Python module on M1.

bast commented 2 years ago

More relevant reference issue: https://github.com/actions/runner/issues/805

gayverjr commented 2 years ago

Oh, somehow I missed that it wasn't grabbing a wheel; it's downloading numgrid-1.1.2, that makes a lot of sense. I just cloned the repo and pip installed from source and there were zero issues, so the good news is that it doesn't look like there's anything that needs to be fixed on your end.

As far as an automated workflow for generating the wheels goes, hopefully GitHub actions will add support soon, but for what it's worth cibuildwheel appears to (I've never used it so I can't attest to whether it would work for numgrid).

bast commented 2 years ago

I am glad the local build worked. I will check out cibuildwheel which I did not know about.

corinwagen commented 1 year ago

+1 to more prebuilt distributions, it would be nice to have some Python 3.11 support as well.

(Thanks for such a great project!)

bast commented 1 year ago

I will create a Python 3.11 package this week. Sorry for troubles.

bast commented 3 months ago

Almost a year later ... I finally now created packages for Python 3.10, 3.11, and 3.12.