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

Glmnet Compatibility with M1 MacBooks (Solved) #59

Open
skbwu opened this issue Mar 22, 2022 · 0 comments
Open

Glmnet Compatibility with M1 MacBooks (Solved) #59

skbwu opened this issue Mar 22, 2022 · 0 comments

Comments

@skbwu
Copy link

skbwu commented Mar 22, 2022

Hi everybody,

I had some trouble getting glmnet_python to work with my M1 MacBook Pro (Late 2020). Some error messages I received included "OSError: dlopen(/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/glmnet_py/GLMnet.so, 0x0006): tried: '/opt/homebrew/Caskroom/miniforge/base/envs/tensorflow/lib/python3.9/site-packages/glmnet_py/GLMnet.so' (not a mach-o file), '/usr/local/lib/GLMnet.so' (no such file), '/usr/lib/GLMnet.so' (no such file)"

I just wanted to share my solution that finally got it to work:

  1. Create a virtual conda environment, but force it to only install and use legacy x86-64 packages. The specific instructions for this step can be found here.
  2. Install glmnet_py using pip in this specific environment as usual.
  3. Replace the GLMnet.so file from the pip installation with the GLMnet.so file from here.
  4. Replace "scipy.floor(nobs/nfolds)" in line 260/261 of cvglmnet.py with "int(scipy.floor(nobs/nfolds))". The source of this fix can be found here.

Hope this helps!

@skbwu skbwu changed the title Glmnet Compatibility with M1 MacBooks Glmnet Compatibility with M1 MacBooks (Solved) Mar 22, 2022
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

1 participant