21cmfast / 21cmFAST

Official repository for 21cmFAST: a code for generating fast simulations of the cosmological 21cm signal
MIT License
58 stars 37 forks source link

Unable to install 21cmFast on Mac M1 processor [BUG] #306

Closed chapmanemma closed 1 year ago

chapmanemma commented 1 year ago

I have tried to install 21cmFast on a new MacBook with an M1 chip. I have followed the instructions for installing using pip and while the installation completes, running "import py21cmfast as p21c" results in:

ImportError: dlopen(/Users/student/Documents/21cmFast/21cmFAST/src/py21cmfast/c_21cmfast.abi3.so, 0x0002): tried: '/Users/student/Documents/21cmFast/21cmFAST/src/py21cmfast/c_21cmfast.abi3.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/c_21cmfast.abi3.so' (no such file), '/usr/lib/c_21cmfast.abi3.so' (no such file)

chapmanemma commented 1 year ago

We have managed to install, but only using miniforge and pip.

steven-murray commented 1 year ago

Hi @chapmanemma -- I don't think any of us has had experience trying to install on the M1, sorry for the hassle. Any chance you could provide a little detail on the solution -- we could add it to the docs, or at least leave it here for the future :-)

BradGreig commented 1 year ago

Hi @chapmanemma @steven-murray, not that this is going to be overly useful but I do have 21cmFAST installed on an M1 Apple. I don't recall having any issues installing it though. However, I followed the installation instructions for developers from the docs. Not sure if there is much difference, but it does use pip.

Unfortunately I did not write down/nor do I remember the steps I followed.

I guess the primary issues will be making sure the versions of python and gcc are compatible with the M1 chip. I have gcc v11 and python3.10. FFTW would also need to be compiled under this version.

qyx268 commented 1 year ago

Just wanted to point out that there have been an increasing number of reports for incompatible architecture related to M1 and python. The issue is likely not 21cmfast specific.

chapmanemma commented 1 year ago

cc’ing Luke who figured it out on this end. We were unable to install using the standard conda conda-forge install, but for some reason installing miniconda and then using the pip install command to install worked. It was as “simple” as that in the end. I’m away from my office so cannot reproduce all the errors at the moment but Luke may be able to add something.

On 17 Oct 2022, at 01:18, BradGreig @.**@.>> wrote:

Hi @chapmanemmahttps://github.com/chapmanemma @steven-murrayhttps://github.com/steven-murray, not that this is going to be overly useful but I do have 21cmFAST installed on an M1 Apple. I don't recall having any issues installing it though. However, I followed the installation instructions for developers from the docs. Not sure if there is much difference, but it does use pip.

Unfortunately I did not write down/nor do I remember the steps I followed.

I guess the primary issues will be making sure the versions of python and gcc are compatible with the M1 chip. I have gcc v11 and python3.10. FFTW would also need to be compiled under this version.

— Reply to this email directly, view it on GitHubhttps://github.com/21cmfast/21cmFAST/issues/306#issuecomment-1280105520, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD655WWMH37MTDUH7OM2UNLWDSLNXANCNFSM6AAAAAARFCEVQQ. You are receiving this because you were mentioned.Message ID: @.***>

lconaboy commented 1 year ago

Can't remember the specific errors, but as Emma said the key was to have a miniforge installation as opposed to a standard anaconda installation, which seemed to be mixing up the architectures when installing packages (don't ask me why).

steven-murray commented 1 year ago

Thanks for the tip!