MxNet installation on M1 Mac with Miniconda - (not a mach-o file) Error

Hi’ I’ve been tryig to install MxNet on a M1 Mac, and I’m using Miniconda, which supposedly supports arm-based packages installations.

I created the env by:

conda create --name mc_mxnet_py39 python=3.9

and installed mxnet by:

pip install --upgrade mxnet

I also tried specifying

CONDA_SUBDIR=osx-arm64 pip install --upgrade mxnet

But the result is always the same, when importing mxnet I get the error:

OSError: dlopen(/Users/cdemasi/miniconda3/envs/mc_mxnet_py39/lib/python3.9/site-packages/mxnet/libmxnet.so, 0x0006): tried: '/Users/cdemasi/miniconda3/envs/mc_mxnet_py39/lib/python3.9/site-packages/mxnet/libmxnet.so' (not a mach-o file)

During the installation, I see that it’s doing:

Collecting mxnet
Using cached mxnet-1.6.0-py2.py3-none-any.whl (68.7 MB)

So, I assume there’s an error in the mxnet-1.6.0-py2.py3-none-any.whl file, which is actually not a Mac-compatible version?

Are you able to solve this issue?

Not yet, at least not completely. I opened an issue regarding this problem, but I’ve been mostly ignored so far.
As you can read there, I was able to compile MxNet 2.0.0, so maybe that is gonna solve your problem.

1 Like

Quite Helpful, but some commands are still not working for me :slightly_frowning_face: Anyways, Thanks! Do share if you find any other solution.

I just had the same problem as you. I created a virtual environment for python 3.10, and then reinstalled mxnet. This problem did not arise again.

Are you sure that’s exactly what you did? i just tried it, and it doesn’t work for me. I created a virtual environment for Python 3.10 with conda, installed (without errors) mxnet 1.6.0, but still having the same issue when importing it.

Yes,sure. My python version in 3.10.6 based on Anaconda, my laptop is mbp16(2021,m1pro). Maybe there is something wrong with Miniconda.

Yes, that’s the whole point :slight_smile:
It works with Anaconda because you get the x86_64 version, which is then executed under Rosetta2.

I was asking about installation with Miniconda because it supposedly supports the arm-based architecture of the M1, but as I said, it doesn’t currently work (for reference, with PyTorch and Tensorflow you can install the arm-based versions, and even use the integrated GPU on the M1).

But I have to say that the deep learning speed of the M1pro is really not as good as that of a desktop-level graphics card. I ended up opting for a cloud GPU server (3080), which was 10x faster.

I totally agree, but I’m forced to use the Mac for work, hence the question :slight_smile:

Please try compiling from source following the instructions in the link:

Only, please make sure that instead of git cloning recursive command which ends up installing mxnet 2.0.0. Get the 1.9.1 source from the mxnet downloads section and compile them & also make sure that you turn off and play around with the cmake config file by switching off CUDA or x86 related settings.

This approach worked for me: mxnet 1.9.1 & Python 3.7.13 (not sure if the python version makes sense, I figured out this combination from their official docker release which uses this combination. Other higher Python versions also should work. )

In parallel, I raised an issue (AttributeError when importing DeepAREstimator: module 'mxnet.gluon' has no attribute 'ParameterDict' · Issue #2451 · awslabs/gluonts · GitHub) and got the same response that mxnet 2.0.0 is not compatible with gluonTS.