Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M1 Mac issue when importing ellc (have 'arm64', need 'x86_64') #11

Open
astro-sobrien opened this issue Jan 26, 2023 · 14 comments
Open

Comments

@astro-sobrien
Copy link

I'm using ellc 1.8.7 through allesfitter (v1.2.10) and I'm running into an error which I believe is due to my computer being an Apple M1 MacBook Pro (2020, OS Ventura 13.2). When allesfitter tries to import ellc, I receive the error below. I've tried a few troubleshooting steps such as the one detailed here: https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon-m1/ but to no avail. I'm going to install the packages on another system so I will be able to use them but I'm raising the issue in case there's any fixes that can be applied so that the package is compatible with the new Macbooks.

Traceback (most recent call last):
  File "/Users/seanobrien/Documents/allesfitter_test/run.py", line 17, in <module>
    import allesfitter
  File "/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/allesfitter/__init__.py", line 47, in <module>
    from .mcmc import mcmc_fit
  File "/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/allesfitter/mcmc.py", line 37, in <module>
    from .computer import update_params, calculate_lnlike_total
  File "/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/allesfitter/computer.py", line 27, in <module>
    from ellc import fluxes, lc, rv
  File "/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/ellc/fluxes.py", line 21, in <module>
    from ellc import ellc_f
ImportError: dlopen(/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so, 0x0002): tried: '/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (no such file), '/Users/seanobrien/anaconda3/envs/allesfitter/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
@wangxianyu7
Copy link

wangxianyu7 commented Feb 19, 2023

Hi, I am also using ellc on my Mac and I had a similar issue a few days ago. Here is the procedure you can follow to install it:

  1. Install Xcode using the following command:
xcode-select --install
  1. Open Terminal using Rosetta
    https://www.youtube.com/watch?v=9W8rTTE1WEA
    https://developer.ibm.com/blogs/running-x8664-apps-on-apple-silicon-processors

  2. Install Homebrew (https://brew.sh/) and gfortran using the command:

brew install gcc
  1. Download and install Miniforge from this link: https://github.com/conda-forge/miniforge
  2. Install all the packages you need using the command:
pip install numpy matplotlib seaborn scipy astropy statsmodels emcee corner tqdm dynesty celerite h5py rebound
  1. Finally, install ellc and allesfitter using the following command:
pip install ellc allesfitter

Note that it is not recommended to use Miniconda as I tried to install allesfitter with it and it failed.
If you have any other questions, please let me know! Have fun with ellc!

@pmaxted
Copy link
Owner

pmaxted commented Feb 20, 2023

Thanks. I will leave this open for others to find these useful instructions.

@rj627
Copy link

rj627 commented Aug 31, 2023

Hi -- I have been having issues running ellc from within Phoebe; it's complaining that the architecture is not correct, with an error the same as the one given above. I've tried almost everything I can find online, including multiple iterations of the above steps, and nothing seems to work to resolve this issue.

Does anyone have any other suggestions? I've re-installed XCode, the modules (ellc, phoebe, numpy, astropy) multiple times, and have tried forcing the architecture by adding the arch -arm64 flag to some commands, but no dice. Thanks in advance for any help that can be provided!

File [~/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/phoebe/backend/backends.py:2457](https://file+.vscode-resource.vscode-cdn.net/Users/rahuljayaraman/Documents/TESS%20Research/Papers/TTPs%20from%20Fourier%20Search/~/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/phoebe/backend/backends.py:2457), in EllcBackend.run_checks(self, b, compute, times, **kwargs)
   2456 try:
-> 2457     from ellc import lc as _ellc_lc
   2458     from ellc import rv as _ellc_rv

File [~/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/lc.py:21](https://file+.vscode-resource.vscode-cdn.net/Users/rahuljayaraman/Documents/TESS%20Research/Papers/TTPs%20from%20Fourier%20Search/~/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/lc.py:21)
     19 import numpy as np
---> 21 from ellc import ellc_f
     23 def lc(t_obs, radius_1, radius_2, sbratio, incl, 
     24        light_3 = 0, 
     25        t_zero = 0, period = 1,
   (...)
     43        spots_1=None, spots_2=None, 
     44        exact_grav=False, verbose=1):

ImportError: dlopen(/Users/rahuljayaraman/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so, 0x0002): tried: '/Users/rahuljayaraman/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/rahuljayaraman/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (no such file), '/Users/rahuljayaraman/miniforge3/envs/phoebe_env/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

@sdcorle1
Copy link

I'm having the same issues as rj627. Has there been a solution?

ImportError Traceback (most recent call last)
Cell In[3], line 1
----> 1 from ellc import fluxes

File ~/opt/anaconda3/lib/python3.9/site-packages/ellc/fluxes.py:21
17 from future import (absolute_import, division, print_function,
18 unicode_literals)
19 import numpy as np
---> 21 from ellc import ellc_f
23 def fluxes(t_obs, radius_1, radius_2, sbratio, incl,
24 t_zero = 0, period = 1,
25 a = None,
(...)
42 spots_1=None, spots_2=None,
43 exact_grav=False, verbose=1):
44 """
45 Calculate the fluxed emitted from each star in an eclipsing binary star
46
(...)
330
331 """

ImportError: dlopen(/Users/subercorley/opt/anaconda3/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so, 0x0002): tried: '/Users/subercorley/opt/anaconda3/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/subercorley/opt/anaconda3/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (no such file), '/Users/subercorley/opt/anaconda3/lib/python3.9/site-packages/ellc/ellc_f.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

@wangxianyu7
Copy link

wangxianyu7 commented Nov 24, 2023

Hi everyone, I have updated the instructions. Ellc is currently incompatible with Apple's M1/2 chip. But you can run it with Rosetta. Here are the updated instructions at #11 (comment).

@sdcorle1
Copy link

sdcorle1 commented Nov 24, 2023 via email

@wangxianyu7
Copy link

wangxianyu7 commented Dec 2, 2023

As was suggested by Wang, I have attempted to resolve the arm64 vs x86-64 issue. I reviewed the YouTube video and the IBM site. Neither of the suggested processes led me to the Rosetta installation site. I am currently running Sonoma 14.1.1 as you can see below. When I right click on the terminal application in the Finder screen, the duplicate function is not on the drop down as was indicated in the video. I can find no way to create a copy of the terminal app that provides a checkbox to select Rosetta. Also, contrary to what was shown in the video, the activity monitor does not include an “architecture” column. As to the IBM suggestion that attempting to execute an intel app would bring up a prompt that would lead to Rosetta, I attempted this with SAOImageDS9 which I screenshot below. You can see that the “kind” is an Intel application. This application runs all the time with my current configuration with no issues. I am very interested in using this application and would appreciate any thoughts that you have on a solution or potential solution. Thank you, Suber Corley
On 23-11-2023, at 23:03, Xian-Yu Wang @.***> wrote: Hi everyone, I have updated the instructions. Ellc is currently incompatible with Apple's M1 chip and requires Rosetta. Here is the updated instructions at #11 (comment) https://urldefense.com/v3/__https://github.com/pmaxted/ellc/issues/11*issuecomment-1436017036__;Iw!!IKRxdwAv5BmarQ!aJjaNXdcl5GX9jzb_9Ty295PFOzjge0QJOjq6IeP9T-bkGCzaaQh86m_zzfU1mppNlcVN7xLoaYwPbNyILcAVhqK$ for more information. — Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/pmaxted/ellc/issues/11*issuecomment-1825062909__;Iw!!IKRxdwAv5BmarQ!aJjaNXdcl5GX9jzb_9Ty295PFOzjge0QJOjq6IeP9T-bkGCzaaQh86m_zzfU1mppNlcVN7xLoaYwPbNyIKu9z_pQ$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/A36KMLEOWBNXFBQYI4BBS6DYF756PAVCNFSM6AAAAAAUHJBAWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRVGA3DEOJQHE__;!!IKRxdwAv5BmarQ!aJjaNXdcl5GX9jzb_9Ty295PFOzjge0QJOjq6IeP9T-bkGCzaaQh86m_zzfU1mppNlcVN7xLoaYwPbNyIKoxrZUM$. You are receiving this because you commented.


Hi Suber,

Thanks for letting us know about the issue. I updated to Sonoma 14.1.1 this week and encountered the same problem. It seems like we can no longer duplicate the Terminal. However, you can still use Terminal with Rosetta by right-clicking on the Terminal, selecting 'Get Info', and then choosing the 'Open using Rosetta' option.

image

Best,
Xian-Yu

@wangxianyu7
Copy link

wangxianyu7 commented Dec 2, 2023

Here is a method to install ellc without Rosetta, which I just tested on my Mac Mini (M2). If you encounter any issues installing it using the method below, feel free to let me know.

  1. Install Miniforge/Anaconda/Miniconda
    Download Miniforge from this link.

  2. Create an Environment
    Import this file (rename it to 'ellc.yml' before importing): ellc.txt. Use the command:
    conda create -n ellc -f ellc.yml
    Install Xcode Command Line Tools
    xcode-select --install
    Install gfortran
    conda install gfortran

  3. Install ellc
    pip install ellc==1.8.7

  4. Update ellc Installation
    Navigate to the ellc installation path (Use 'pip uninstall ellc' can let know the path, but do not uninstall it) and replace the file 'ellc_f.cpython-38-darwin.so' with the file from the following link (change its suffix to .so): ellc_f.cpython-38-darwin.txt.

Notes:

  1. You can use either Miniforge or conda. I have been using Miniforge since I got a Mac with an M1 chip, and it works great. If you cannot install ellc using Ana/Miniconda, try Miniforge and leave a comment here to let others know.
  2. I previously compiled ellc and obtained this .so file I uploaded but forgot the exact process. The orignal .so file might result in an error like 'AttributeError: module 'ellc' has no attribute 'fluxes''.

Best,
Xian-Yu

@sdcorle1
Copy link

sdcorle1 commented Dec 4, 2023 via email

@sdcorle1
Copy link

sdcorle1 commented Dec 4, 2023 via email

@wangxianyu7
Copy link

wangxianyu7 commented Dec 4, 2023

Hi @sdcorle1, you need to specify the installation path in the final line of the ellc.yml file.

Best,
Xian-Yu

Xian-Yu, By the way, I installed the X86_64 version of Miniforge3. Was that wrong to do since I have an Arm64 chip? Suber

On 04-12-2023, at 09:49, Suber Corley @.> wrote: Xian-Yu In Step 2, I got the following error message: (.venv) (base) iMac:allesfitter subercorley$ conda create -f ellc.yml usage: conda create [-h] [--clone ENV] (-n ENVIRONMENT | -p PATH) [-c CHANNEL] [--use-local] [--override-channels] [--repodata-fn REPODATA_FNS] [--experimental {jlap,lock}] [--strict-channel-priority] [--no-channel-priority] [--no-deps | --only-deps] [--no-pin] [--copy] [-C] [-k] [--offline] [--json] [-v] [-q] [-d] [-y] [--download-only] [--show-channel-urls] [--file FILE] [--no-default-packages] [--solver {classic,libmamba} | --experimental-solver {classic,libmamba}] [--dev] [package_spec ...] conda create: error: one of the arguments -n/--name -p/--prefix is required This is the content of the current directory: (.venv) (base) iMac:allesfitter subercorley$ ls allesfitter-master allesfitter_python_setup.ipynb allesfitter-master.zip ellc.yml allesfitter_gui.ipynb Any suggestions? Thanks, Suber > On 02-12-2023, at 00:46, Xian-Yu Wang @.> wrote: > > > Here is a method to install ellc without Rosetta, which I just tested on my Mac Mini (M2). If you encounter any issues installing it using the method below, feel free to let me know. > > Install Miniforge/Anaconda/Miniconda > Download Miniforge from this link https://urldefense.com/v3/__https://github.com/conda-forge/miniforge__;!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3Dp2GDlb$. > > Create an Environment > Import this file (rename it to 'ellc.yml' before importing): ellc.txt https://urldefense.com/v3/__https://github.com/pmaxted/ellc/files/13533231/ellc.txt__;!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3NbNQ6h6$. Use the command: > conda create -f ellc.yml > Install Xcode Command Line Tools > xcode-select --install > Install gfortran > conda install gfortran > > Install ellc > pip install ellc==1.8.7 > > Update ellc Installation > Navigate to the ellc installation path (Use 'pip uninstall ellc' can let know the path, but do not uninstall it) and replace the file 'ellc_f.cpython-38-darwin.so' with the file from the following link (change its suffix to .so): ellc_f.cpython-38-darwin.txt https://urldefense.com/v3/__https://github.com/pmaxted/ellc/files/13533247/ellc_f.cpython-38-darwin.txt__;!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3AFEzYeO$. > > Notes: > > You can use either Miniforge or conda. I have been using Miniforge since I got a Mac with an M1 chip, and it works great. If you cannot install ellc using Ana/Miniconda, try Miniforge and leave a comment here to let others know. > I previously compiled ellc and obtained this .so file I uploaded but forgot the exact process. The orignal .so file might result in an error like 'AttributeError: module 'ellc' has no attribute 'fluxes''. > Best, > Xian-Yu > > — > Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/pmaxted/ellc/issues/11*issuecomment-1837026810__;Iw!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3JEMZCER$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/A36KMLFJEZCGRLRXNL2BYBDYHKP7VAVCNFSM6AAAAAAUHJBAWGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGAZDMOBRGA__;!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3J8q-49d$. > You are receiving this because you commented. >

@sdcorle1
Copy link

sdcorle1 commented Dec 4, 2023 via email

@wangxianyu7
Copy link

try 'conda create -n ellc -f ellc.yml'

Xian-Yu, I made the change to the yml file as you suggested. prefix: /Users/subercorley/miniforge3/envs/ellc However, I got the same error: (base) iMac:allesfitter subercorley$ conda create -f ellc.yml usage: conda create [-h] [--clone ENV] (-n ENVIRONMENT | -p PATH) [-c CHANNEL] [--use-local] [--override-channels] [--repodata-fn REPODATA_FNS] [--experimental {jlap,lock}] [--strict-channel-priority] [--no-channel-priority] [--no-deps | --only-deps] [--no-pin] [--copy] [-C] [-k] [--offline] [-d] [--json] [-q] [-v] [-y] [--download-only] [--show-channel-urls] [--file FILE] [--no-default-packages] [--solver {classic,libmamba} | --experimental-solver {classic,libmamba}] [--dev] [package_spec ...] conda create: error: one of the arguments -n/--name -p/--prefix is required I put the ellc.yml file into my allesfitter main directory and that is where I am executing the conda create. Which directory are you in when you execute the conda create function? Should I be doing this inside the miniforge3 directory? Thanks, Suber

On 02-12-2023, at 00:46, Xian-Yu Wang @.***> wrote: ellc.txt https://urldefense.com/v3/__https://github.com/pmaxted/ellc/files/13533231/ellc.txt__;!!IKRxdwAv5BmarQ!fTXnlxp9q95aTtR8VKceFV0ILGXLuZFljOLhQioqtWAfJyJhd43nQG5rpfLsqm6OF5CGhgNUFkwRbsRz3NbNQ6h6$

@pmaxted
Copy link
Owner

pmaxted commented Dec 4, 2023

Thanks Xian-Yu, and everyone else who has contributed to this discussion. I do not have an M1 mac yet so there is not a lot I can do to help for now. I will leave this issue open until I can get the instructions written-up as part of the ReadMe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants