How to help iJulia notebook find an externally compiled library

135 views Asked by At

I am trying to run a compiled version of mxnet in an iJulia notebook, but when I execute the command using MXNet, I get the follow error:

InitError: error compiling __init__: error compiling _populate_symbol_creator_cache!: error compiling _get_atomic_symbol_creators: could not load library "/home/milton/mxnet/lib/libmxnet.so"
libcudart.so.7.5: cannot open shared object file: No such file or directory
during initialization of module mx

in _include_from_serialized(::String) at ./loading.jl:150
in _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:187
in _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:217
in require(::Symbol) at ./loading.jl:371

Figuring it might be ENV getting cleared, I added:

ENV["MXNET_HOME"] = "/home/milton/mxnet"
ENV["LD_LIBRARY_PATH"] = "/home/milton/mxnet/lib:/usr/local/cuda/lib64"

This allows me to execute the instruction using MXNet without error, but raises the error again when trying to execute any commands from the mxnet library

error compiling #Variable#215: could not load library "/home/milton/programming/mxnet/lib/libmxnet.so"
libcudart.so.7.5: cannot open shared object file: No such file or directory

in Variable(::Symbol) at /home/milton/.julia/v0.5/MXNet/src/symbolic-node.jl:232

How do I fix this? Is there somewhere else I need to define the path? Everything works fine from the REPL.

1

There are 1 answers

0
ultradian On

I got this working with some help on GitHub. I learned there that the LD_LIBRARY_PATH is processed by the dynamic link loader and fixed when the program is started as described in the answer to this SO question. Even though it appears changed when messing with it in the notebook, it isn't.

To get this to work, I start jupyter-notebook in a terminal with the proper LD_LIBRARY_PATH set (in my case my .bashrc automatically includes a path to my compiled mxnet/lib, so it works in any local terminal. It isn't in my global setup).