mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

import mxnet in arm64 error

Open lele012 opened this issue 4 years ago • 18 comments

Description

This error occurred when I was using MXNET on ARM64。

“/usr/local/lib/python3.7/site-packages/mxnet/libmxnet.so”,but in the path,lib file(libmxnet.so) is existed.

I installed MXNET by "pip install mxnet"。Is there no ARM64 MXNET image on Dockerhub ?

Error Message

root@face-6ff98747f6-rtl5n:/# python Python 3.7.9 (default, Sep 10 2020, 15:29:47) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import mxnet as mx Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/site-packages/mxnet/init.py", line 24, in from .context import Context, current_context, cpu, gpu, cpu_pinned File "/usr/local/lib/python3.7/site-packages/mxnet/context.py", line 24, in from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass File "/usr/local/lib/python3.7/site-packages/mxnet/base.py", line 214, in _LIB = _load_lib() File "/usr/local/lib/python3.7/site-packages/mxnet/base.py", line 205, in _load_lib lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL) File "/usr/local/lib/python3.7/ctypes/init.py", line 364, in init self._handle = _dlopen(self._name, mode) OSError: /usr/local/lib/python3.7/site-packages/mxnet/libmxnet.so: cannot open shared object file: No such file or directory

lele012 avatar Sep 27 '20 01:09 lele012

Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue. Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly. If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on contributing to MXNet and our development guides wiki.

github-actions[bot] avatar Sep 27 '20 01:09 github-actions[bot]

@lele012 at the moment users need to build from source for arm support. The one available on pip should be for amd64 only. We are planning on adding official arm support in near future. cc @sandeep-krishnamurthy

szha avatar Sep 27 '20 01:09 szha

@szha Ok,i know ,thanks。Later,i will try to build from source.

lele012 avatar Sep 27 '20 01:09 lele012

@mseth10 @josephevans

sandeep-krishnamurthy avatar Sep 27 '20 02:09 sandeep-krishnamurthy

@lele012 at the moment users need to build from source for arm support. The one available on pip should be for amd64 only. We are planning on adding official arm support in near future. cc @sandeep-krishnamurthy

Is there a link to building it from source for arm64?

nirantarashwin avatar Oct 14 '20 17:10 nirantarashwin

You can follow the normal build-from-source instructions @nirantarashwin. If you like to do cross-compile, you can set up your environment by following https://github.com/apache/incubator-mxnet/blob/12ec04611c78a603c03707488d66bdbbedf0d536/ci/docker/Dockerfile.build.arm#L109-L128 and pass the -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} argument to cmake when configuring the compilation.

leezu avatar Oct 14 '20 18:10 leezu

You can follow the normal build-from-source instructions @nirantarashwin. If you like to do cross-compile, you can set up your environment by following

https://github.com/apache/incubator-mxnet/blob/12ec04611c78a603c03707488d66bdbbedf0d536/ci/docker/Dockerfile.build.arm#L109-L128

and pass the -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} argument to cmake when configuring the compilation.

Got it. Thank you very much :)

nirantarashwin avatar Oct 14 '20 19:10 nirantarashwin

@nirantarashwin Have you built it on arm64 successfully? thanks very much.

leoaaaaaaa avatar Sep 21 '21 05:09 leoaaaaaaa

@szha Have we already released the arm64 build? thanks very much.

leoaaaaaaa avatar Sep 21 '21 05:09 leoaaaaaaa

@szha @nirantarashwin Is there any update on the official support for mxnet whl for arm CPU? Also, build from source instructions available at https://mxnet.apache.org/versions/1.8.0/get_started/build_from_source are not proper! It says python3 -m pip install --user -e ./python without other make or build instructions.

Can you provide more details on this, please?

Thank you.

xintin avatar Sep 24 '21 13:09 xintin

@mseth10 worked on arm build and may be able to provide update

szha avatar Sep 26 '21 14:09 szha

Any update on this?

Tomaubier avatar Jan 12 '22 16:01 Tomaubier

Hi @Tomaubier , here's the public MXNet 1.9 wheel that supports aarch64 https://repo.mxnet.io/dist/python/cpu/mxnet-1.9.0-py3-none-manylinux2014_aarch64.whl . Currently it takes ArmPL as a dependency, so you need to install ArmPL corresponding to your OS from here https://developer.arm.com/tools-and-software/server-and-hpc/downloads/arm-performance-libraries For example, these worked for me on rhel7

# install Arm Performance Libraries
wget https://developer.arm.com/-/media/Files/downloads/hpc/arm-performance-libraries/21-1-0/RHEL7/arm-performance-libraries_21.1_RHEL-7_gcc-8.2.tar?revision=d6133508-1bcc-4fca-aeb1-4bba06d3898f
tar -xvf arm-performance-libraries_21.1_RHEL-7_gcc-8.2.tar\?revision\=d6133508-1bcc-4fca-aeb1-4bba06d3898f 
sudo arm-performance-libraries_21.1_RHEL-7_gcc-8.2/arm-performance-libraries_21.1_RHEL-7.sh -a
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/arm/armpl_21.1_gcc-8.2/lib

# Install MXNet that takes Arm PL as a dependency
wget https://repo.mxnet.io/dist/python/cpu/mxnet-1.9.0-py3-none-manylinux2014_aarch64.whl
python3 -c 'import mxnet'

mseth10 avatar Jan 19 '22 21:01 mseth10

any updates?

chenx2018 avatar Apr 02 '22 01:04 chenx2018

updates?

TobiasRafael avatar Apr 08 '22 22:04 TobiasRafael

wget https://repo.mxnet.io/dist/python/cpu/mxnet-1.9.0-py3-none-manylinux2014_aarch64.whl python3 -c 'import mxnet'

I ran through all these steps on aarch64 using ubuntu 20.04 but didnt seem to work.

root@qrb5165-rb5:~/mxnet# python3.6 Python 3.6.9 (default, Jun 29 2022, 11:45:57) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import mxnet Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/mxnet/init.py", line 23, in from .context import Context, current_context, cpu, gpu, cpu_pinned File "/usr/local/lib/python3.6/dist-packages/mxnet/context.py", line 23, in from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass File "/usr/local/lib/python3.6/dist-packages/mxnet/base.py", line 356, in _LIB = _load_lib() File "/usr/local/lib/python3.6/dist-packages/mxnet/base.py", line 347, in _load_lib lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL) File "/usr/lib/python3.6/ctypes/init.py", line 348, in init self._handle = _dlopen(self._name, mode) OSError: libarmpl_lp64_mp.so: cannot open shared object file: No such file or directory

Any way to resolve this?

ashsyal avatar Oct 02 '22 02:10 ashsyal

Here are my steps for reference:

  1. wget https://developer.arm.com/-/media/Files/downloads/hpc/arm-performance-libraries/22-0-2/Ubuntu20.04/arm-performance-libraries_22.0.2_Ubuntu-20.04_gcc-11.2.tar?rev=577d3dbcff7847b9af57399b2978f9a6&revision=577d3dbc-ff78-47b9-af57-399b2978f9a6
  2. tar -xvf arm-performance-libraries_22.0.2_Ubuntu-20.04_gcc-11.2.tar?rev=577d3dbcff7847b9af57399b2978f9a6
  3. sudo arm-performance-libraries_22.0.2_Ubuntu-20.04/arm-performance-libraries_22.0.2_Ubuntu-20.04.sh -a
  4. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/arm/armpl-22.0.2-gcc-11.2/lib
  5. wget https://repo.mxnet.io/dist/python/cpu/mxnet-1.9.0-py3-none-manylinux2014_aarch64.whl
  6. pip3 install mxnet-1.9.0-py3-none-manylinux2014_aarch64.whl

I am using a Qualcomm QRB5165 aarch64 chipset

ashsyal avatar Oct 02 '22 02:10 ashsyal

please has anyone resolved this i am still getting error when i try to run "import mxnet" on my Xilinx FPGA board

Joetibz avatar Feb 16 '23 08:02 Joetibz