nasa / radbelt

radbelt: An Astropy-friendly wrapper for the AE-8/AP-8 Van Allen belt model
Other
28 stars 9 forks source link

Build wheels for macOS arm64 #3

Closed Toldbo closed 5 months ago

Toldbo commented 1 year ago

Hello I am trying to install radbelt into a conda environement using:
/Users/t/opt/anaconda3/envs/radbelt/bin/pip install git+https://github.com/nasa/radbelt.git

but I get the error: ERROR: Failed building wheel for radbelt ERROR: Could not build wheels for radbelt, which is required to install pyproject.toml-based projects

I have also tried installing using the setup.py but I get the message : /Users/t/opt/anaconda3/envs/radbelt/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Can anybody help?

lpsinger commented 1 year ago

Yes, we probably need to enable wheels for M1 Macs. Will do shortly.

Toldbo commented 1 year ago

I managed (with help from a friend) to install it in the end. I updated homebrew, used python instead of conda, downloaded compilers again.

etmeyer commented 1 year ago

Yes, having a similar issue here. We're actually trying to install the dorado-scheduling package on M1 macs and the dependency on radbelt is causing problems when using python 3.10. (Earlier python 3.8, 3.9 cause even worse problems with the multiprocessing pkg). I'd prefer to do this using a conda environment if possible, as I can't guarantee that everyone's system python will have the right package versions, etc. Radbelt installs ok but running one of the dorado examples results in an error (you can ignore the dorado-->axis sub, this is a straight clone otherwise!):

Traceback (most recent call last): File "/Users/meyer/opt/anaconda3/envs/axis-sched/bin/axis-scheduling", line 5, in from axis.scheduling.scripts.main import main File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/axis/scheduling/init.py", line 9, in from .orbit import Orbit, Spice, TLE File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/axis/scheduling/orbit/init.py", line 8, in from .base import Orbit File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/axis/scheduling/orbit/base.py", line 10, in from ..constraints import OrbitNightConstraint File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/axis/scheduling/constraints/init.py", line 18, in from .radiation import TrappedParticleFluxConstraint File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/axis/scheduling/constraints/radiation.py", line 9, in from radbelt import get_flux File "/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/radbelt/init.py", line 13, in from .core import igrf as _igrf, aep8 as _aep8 ImportError: dlopen(/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/radbelt/core.cpython-310-darwin.so, 0x0002): tried: '/Applications/CPLEX_Studio2211/opl/bin/arm64_osx/core.cpython-310-darwin.so' (no such file), '/core.cpython-310-darwin.so' (no such file), '/Users/meyer/opt/anaconda3/envs/axis-sched/lib/python3.10/site-packages/radbelt/core.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

lpsinger commented 1 year ago

Unfortunately, we don't have prebuilt wheels for Apple silicon machines yet. We rely on GitHub Actions runners to build them, and GitHub hasn't added these machines yet. According to https://github.com/github/roadmap/issues/528, they are anticipated in 2023 Q3.

kokroo commented 10 months ago

Unfortunately, we don't have prebuilt wheels for Apple silicon machines yet. We rely on GitHub Actions runners to build them, and GitHub hasn't added these machines yet. According to github/roadmap#528, they are anticipated in 2023 Q3.

Do we really need Apple Silicon runners for that? Cross-platform/architecture compilation exists and I would love to help with it.

I have Windows, Linux, and macOS machines (Both Intel and Apple Silicon macs). I can help you out with this, just need some pointers first :)

Cheers! @lpsinger

lpsinger commented 10 months ago

@kokroo, there is an existing PR for this, #16. As you can see from the CI logs, it's failing because the version of libgfortran provided by Homebrew is neither an arm64 binary nor a universal binary.

kokroo commented 10 months ago

@lpsinger I just checked the whole issue. It's not a homebrew issue really, turns out there's no stable Fortran compiler that's easily usable on Apple Silicon right now.

I will just rewrite our Fortran code in another portable language and this won't be an issue. Cheers!

lpsinger commented 5 months ago

@kokroo, would you please check if the Apple Silicon wheels from #69 work?

kokroo commented 5 months ago

@kokroo, would you please check if the Apple Silicon wheels from #69 work?

It works, tested with Python 3.11 and 3.12 on an M1 Pro with the latest macOS.