Ritesh Dubal
Ritesh Dubal

Reputation: 45

RuntimeError: Cannot find the MXNet library

I want to create executable for my code where i'm using mxnet with pyinstaller.

I got this error

File "mxnet/libinfo.py", line 74, in find_lib_path
RuntimeError: Cannot find the MXNet library.
List of candidates:
/home/rit/test/exe/dist/test/libmxnet.so
/home/rit/test/exe/dist/test/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/../../lib/libmxnet.so
/home/rit/test/exe/dist/test/mxnet/../../build/libmxnet.so

Added libmxnet.so though spec file but gave me PyInstallerImportError

Uninstalled mxnet though pip and copied python3.5/dist-packages/mxnet to my project same problem facing.

File "PyInstaller/loader/pyiboot01_bootstrap.py", line 151, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll '/home/rit/test/exe/dist/test/libmxnet.so'. Most probably this dynlib/dll was not found when the application was frozen.

Now what is dynlib/dll? How to resolve this error?

Thanks

Upvotes: 2

Views: 3623

Answers (2)

xiaoming
xiaoming

Reputation: 31

if you are using linux, can run like me.

find / -name "libmxnet.so"
export MXNET_LIBRARY_PATH={result of you find}

my find result is like this:

/opt/apps/mxnet/build/libmxnet.so
/usr/local/mxnet/libmxnet.so

so I will do:

export MXNET_LIBRARY_PATH=/usr/local/mxnet/libmxnet.so

Upvotes: 0

Masoud Rahimi
Masoud Rahimi

Reputation: 6061

MXNet needs external binaries to be fed when you freeze it. You can use add-data flag to add libmxnet files to your executable:

pyinstaller -F --add-data="<python_path>/lib/python3.7/site-packages/mxnet/*.so*:./mxnet" script.py 

Upvotes: 4

Related Questions