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:
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.
Install glmnet_py using pip in this specific environment as usual.
Replace the GLMnet.so file from the pip installation with the GLMnet.so file from here.
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.
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:
Hope this helps!