Trying to install MxNet and GluonCV on Mac M1
I've been trying to install MxNet and GluonCV on a M1 Mac, and I'm using Miniconda, which supposedly supports arm-based packages installations. I tried a couple of approaches so far, without any success
Installation with pip I created the env by:
conda create --name mc_mxnet_py39 python=3.9and installed mxnet by:
pip install --upgrade mxnetI also tried specifying
CONDA_SUBDIR=osx-arm64 pip install --upgrade mxnetBut 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?
Then, I tried building it from source
- MxNet 2.0.0 I followed the instructions on this page, which seemed to work, I built and installed MxNet 2.0.0. My problem now is to install GluonCV as well. I tried installing it with pip, and everything seemed to work as well. But then when , when running a simple object detection script, I got the error:
RuntimeError: Legacy mxnet==2.0.0 detected, some modules may not work properly. mxnet>=1.4.0,<2.0.0 is required. You can use pip to upgrade mxnet "pip install -U 'mxnet>=1.4.0,<2.0.0'" or "pip install -U 'mxnet-cu100>=1.4.0,<2.0.0'"
(I also tried building Gluoncv from source as well, but I'm getting the same error, the issue seems to be the MxNet version)
- MxNet 1.7.0: building fails, when running "cmake --build ." I got this error:
1 error generated. make[2]: *** [3rdparty/mkldnn/src/cpu/CMakeFiles/dnnl_cpu.dir/jit_utils/jitprofiling/jitprofiling.c.o] Error 1 make[1]: *** [3rdparty/mkldnn/src/cpu/CMakeFiles/dnnl_cpu.dir/all] Error 2 make: *** [all] Error 2
so, I modified the config.cmake file (copied from config/darwin.cmake to the root folder), by setting:
set(USE_MKL_IF_AVAILABLE OFF CACHE BOOL "Use Intel MKL if found") set(USE_MKLDNN OFF CACHE BOOL "Build with MKL-DNN support")
but now it seems it got even worse (always after running "cmake --build ."):
fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make[2]: *** [CMakeFiles/mxnet_static.dir/src/api/_api_internal/_api_internal.cc.o] Error 1 make[1]: *** [CMakeFiles/mxnet_static.dir/all] Error 2 make: *** [all] Error 2
- I'll try building version 1.6.0, and see if it works
Originally posted by @LewsTherin511 in https://github.com/apache/incubator-mxnet/discussions/20650#discussioncomment-2505821
Source: apache/mxnet