apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.75k stars 6.8k forks source link

Incorrect wheel packaging with manylinux2014 #20885

Open mgiessing opened 2 years ago

mgiessing commented 2 years ago

Description

When I build mxnet python3 wheel for ppc64le architecture everything seems to work in the build container, but if I install the wheel somewhere else (besides the build container) it throws errors about not finding libraries. Usually those issues are handled via auditwheel repair --plat ... but it seems like the packaging is still wrong for mxnet.

Error Message

>>> import mxnet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/mxnet/__init__.py", line 23, in <module>
    from .context import Context, current_context, cpu, gpu, cpu_pinned
  File "/usr/local/lib/python3.7/site-packages/mxnet/context.py", line 23, in <module>
    from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
  File "/usr/local/lib/python3.7/site-packages/mxnet/base.py", line 356, in <module>
    _LIB = _load_lib()
  File "/usr/local/lib/python3.7/site-packages/mxnet/base.py", line 341, in _load_lib
    lib_path = libinfo.find_lib_path()
  File "/usr/local/lib/python3.7/site-packages/mxnet/libinfo.py", line 73, in find_lib_path
    'List of candidates:\n' + str('\n'.join(dll_path)))
RuntimeError: Cannot find the MXNet library.
List of candidates:
/usr/local/lib/python3.7/site-packages/mxnet/libmxnet.so
/usr/local/lib/python3.7/site-packages/mxnet/../../lib/libmxnet.so
/usr/local/lib/python3.7/site-packages/mxnet/../../build/libmxnet.so
../../../libmxnet.so

This issue happens if i install the wheel in a python:3.7 container via pip3 install mxnet-1.9.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

To Reproduce

1 Start build container:

docker run -ti --rm quay.io/pypa/manylinux2014_ppc64le

2 Build script:

# prereqs

yum install -y epel-release centos-release-scl
yum install -y git make ninja-build automake autoconf libtool protobuf-compiler protobuf-devel atlas-devel \
    openblas-devel lapack-devel opencv-devel openssl-devel zeromq-devel

git clone -b 1.9.0 --recursive https://github.com/apache/incubator-mxnet.git mxnet && cd mxnet

# build library
mkdir build && cd build
cmake \
    -DUSE_CUDA=0 \
    -DBLAS=open \
    -DUSE_OPENCV=1 \
    -GNinja \
    ..

ninja install

# build python binding

export MXNET_LIBRARY_PATH=/mxnet/build/libmxnet.so
cd /mxnet/python
/opt/python/cp37-cp37m/bin/python3 setup.py bdist_wheel
auditwheel repair --plat manylinux2014_ppc64le dist/mxnet-1.9.0-py3-none-any.whl

What have you tried to solve it?

  1. Try to deal with the packaging, because libmxnet.so is clearly there, but in another path:
root@ba0e68cb213a:~# find /usr -name "libmxnet.so"
/usr/local/mxnet/libmxnet.so

Environment

I'm building on manylinux2014_ppc64le and using it on "regular" docker.io/python:3.7 container

github-actions[bot] commented 2 years ago

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.