Python package built with the scripts included in this repository is not functional. The libmxnet.so is not installed to the same place as with our Pypi packages.
It will be copied to mxnet/libmxnet.so instead of lib/python3.8/site-packages/mxnet/libmxnet.so
It seems the destination path of package data is not set up correctly (cf https://www.python.org/dev/peps/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl).
RuntimeError: Cannot find the MXNet library.
git clone https://github.com/apache/incubator-mxnet/ mxnet; cd mxnet; git checkout v1.6.x; git submodule update --init --recursivemkdir build; cd build; cmake -DUSE_CUDA=1 -DUSE_MKLDNN=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DBUILD_CYTHON_MODULES=1 ..cd ..pip install wheel./tools/staticbuild/build_wheel.shAlternative, use my version:
pip install --user https://lllausen-data.s3.amazonaws.com/mxnet-1.6.0-py3-none-any.whl
MXNet 1.6 release branch.
CC @lanking520 @szha @zachgk @marcoabreu
Is there any public version of the scripts used for building the pypi release?
You should use tools/staticbuild/build_lib.sh for building the mxnet library. Refer to tools/staticbuild/README.md
This is unrelated to using tools/staticbuild/build_lib.sh for building the mxnet library. The point is that the libmxnet.so is not placed correctly into the wheel by setup.py bdist_wheel (which is run as part of tools/staticbuild/README.md). It seems there's some missing step in the public version of the scripts. Nevertheless I confirm that the bug is still present when following tools/staticbuild/README.md step-by-step.
Installing the released mxnet version from pypi yields:
/home/ubuntu/.local/lib/python3.8/site-packages/mxnet/libmxnet.so
Installing the version built with the scripts yields:
/home/ubuntu/.local/mxnet/libmxnet.so
I think you also had to replace python/setup.py with tools/pip/setup.py
Thanks @zachgk. Actually it seems we have to copy all contents of tools/pip to the folder that contains the mxnet git repository. For example, if mxnet is at ~/src/mxnet-build, then run cp -R ~/src/mxnet-build/tools/pip/* ~/src/; cd ~/src; mxnet_variant=cu100 python setup.py bdist_wheel after running the tools/staticbuild/build.sh cu100 pip inside ~/src/mxnet-build.
tools/staticbuild/build_wheel.sh is broken.
I'll open a PR to add documentation and maybe fix the scripts.
Besides, the scripts currently presume libgfortran.so.3. But on Ubuntu 18.04 and newer, we have libgfortran.so.4. So I'll update the scripts to support both.
The same question. Have you built the mxnet==1.6.0 manually successfully?
Yes. The description in https://github.com/apache/incubator-mxnet/issues/16933#issuecomment-561461776 should be sufficient to build the wheel.
If you're on a system with libgfortran.so.4, you simply have to replace any reference to libgfortran.so.3 in the tools/staticbuild folder with libgfortran.so.4.
Did you meet any problem? If you can create a PR to improve the script and Readme that would be great.
@leezu Wanna ask can I run build.sh on centos or ubuntu only?
@hkvision CMAKE_STATICBUILD=1 ./tools/staticbuild/build.sh cpu is also supported on OS X.
@leezu Thanks.
Another question is that when I run build.sh once and encounter failures, is there any flag to skip the successfully downloaded and built packages? If I don't delete the folder staticdeps, the program always asks me to keep/rename/... every single file on that folder... If I delete the folder, everything needs to be re-downloaded and it is time consuming.
Thanks so much!
@hkvision it will skip compiling the dependency iff it was compiled successfully before.
A PR to improve the situation in case of failure to compile dependency is of course welcome
As a workaround, I suggest you set up ccache on your machine, in which case recompilation amounts to cache lookups.
always asks me to keep/rename/... every single file on that folder
There should be an option "Overwrite All", usually invoked with "A" key.