dmlc / MXNet.jl

MXNet Julia Package - flexible and efficient deep learning in Julia
371 stars 70 forks source link

Pkg.add Ubuntu not working #416

Closed davidbp closed 6 years ago

davidbp commented 6 years ago

Hello,

I just installed the package using Pkg.add("MXNet") and I get the following errors:

julia> using MXNet
INFO: Precompiling module MXNet.

WARNING: deprecated syntax "typealias MX_uint Cuint" at /home/david/.julia/v0.6/MXNet/src/base.jl:10.
Use "const MX_uint = Cuint" instead.

WARNING: deprecated syntax "typealias MX_float Cfloat" at /home/david/.julia/v0.6/MXNet/src/base.jl:11.
Use "const MX_float = Cfloat" instead.

WARNING: deprecated syntax "typealias MX_handle Ptr{Void}" at /home/david/.julia/v0.6/MXNet/src/base.jl:12.
Use "const MX_handle = Ptr{Void}" instead.

WARNING: deprecated syntax "typealias char_p Ptr{UInt8}" at /home/david/.julia/v0.6/MXNet/src/base.jl:14.
Use "const char_p = Ptr{UInt8}" instead.

WARNING: deprecated syntax "typealias char_pp Ptr{char_p}" at /home/david/.julia/v0.6/MXNet/src/base.jl:15.
Use "const char_pp = Ptr{char_p}" instead.
ERROR: LoadError: LoadError: Cannot find or load libmxnet.so. Please see the document on how to build it.
Stacktrace:
 [1] error(::String) at ./error.jl:21
 [2] include_from_node1(::String) at ./loading.jl:569
 [3] include(::String) at ./sysimg.jl:14
 [4] include_from_node1(::String) at ./loading.jl:569
 [5] include(::String) at ./sysimg.jl:14
 [6] anonymous at ./<missing>:2
while loading /home/david/.julia/v0.6/MXNet/src/base.jl, in expression starting on line 26
while loading /home/david/.julia/v0.6/MXNet/src/MXNet.jl, in expression starting on line 24
ERROR: Failed to precompile MXNet to /home/david/.julia/lib/v0.6/MXNet.ji.
Stacktrace:
 [1] compilecache(::String) at ./loading.jl:703
 [2] _require(::Symbol) at ./loading.jl:490
 [3] require(::Symbol) at ./loading.jl:398

I am using Julia 0.6

julia> versioninfo()
Julia Version 0.6.0-rc3.0
Commit ad290e9 (2017-06-07 11:53 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Could you suggest how can I solve this problem? Thank you!

iblislin commented 6 years ago

Try to load libmxnet.so directly.

julia> Libdl.dlopen(Pkg.dir("MXNet", "deps", "usr", "lib", "libmxnet"))
Ptr{Void} @0x0000555557891540

Any error message?

iblislin commented 6 years ago

But why you have those deprecation warning, forgot to Pkg.update()?

davidbp commented 6 years ago

Hello,

I did the Pkg.update(). I assume all is OK since I get:

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Computing changes...
INFO: No packages to install, update or remove

If I do the Libdl you comment I get:

julia> Libdl.dlopen(Pkg.dir("MXNet", "deps", "usr", "lib", "libmxnet"))
ERROR: could not load library "/home/david/.julia/v0.6/MXNet/deps/usr/lib/libmxnet"
/home/david/.julia/v0.6/MXNet/deps/usr/lib/libmxnet.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen(::String, ::UInt32) at ./libdl.jl:97 (repeats 2 times)
iblislin commented 6 years ago

No such file or directory indicates that you need to Pkg.build("MXNet") first usually.

davidbp commented 6 years ago

I did it but it did not work. here is the output

julia> Pkg.build("MXNet")
INFO: Building MXNet
INFO: Found a CUDA installation.
INFO: Attempting to Create directory /home/david/.julia/v0.6/MXNet/deps/src
INFO: Directory /home/david/.julia/v0.6/MXNet/deps/src already created
INFO: Attempting to Create directory /home/david/.julia/v0.6/MXNet/deps/usr/lib
INFO: Directory /home/david/.julia/v0.6/MXNet/deps/usr/lib already created
INFO: Attempting to Create directory /home/david/.julia/v0.6/MXNet/deps/src/mxnet
INFO: Directory /home/david/.julia/v0.6/MXNet/deps/src/mxnet already created
INFO: Changing Directory to /home/david/.julia/v0.6/MXNet/deps/src/mxnet
INFO: Changing Directory to /home/david/.julia/v0.6/MXNet/deps/src/mxnet
remote: Counting objects: 37, done.
remote: Total 37 (delta 25), reused 25 (delta 25), pack-reused 12
Unpacking objects: 100% (37/37), done.
From https://github.com/dmlc/mxnet
   ed21873..cea8d2f  master     -> origin/master
INFO: Changing Directory to /home/david/.julia/v0.6/MXNet/deps/src/mxnet
HEAD is now at 8713d25... [R][DOC] update R installation guide (#6457)
INFO: Changing Directory to /home/david/.julia/v0.6/MXNet/deps/src/mxnet
fatal: reference is not a tree: 89de7ab20167909bc2c4f8acd397671c47cf3c0d
Unable to checkout '89de7ab20167909bc2c4f8acd397671c47cf3c0d' in submodule path 'cub'
=====================================================================================[ ERROR: MXNet ]=====================================================================================

LoadError: failed process: Process(`git submodule update --init`, ProcessExited(1)) [1]
while loading /home/david/.julia/v0.6/MXNet/deps/build.jl, in expression starting on line 58

==========================================================================================================================================================================================

=====================================================================================[ BUILD ERRORS ]=====================================================================================

WARNING: MXNet had build errors.

 - packages with build errors remain installed in /home/david/.julia/v0.6
 - build the package(s) and all dependencies with `Pkg.build("MXNet")`
 - build a single package by running its `deps/build.jl` script

=====================================
iblislin commented 6 years ago

well, according to your error message, I'm pretty sure your source code is too old. what's your Pkg.status("MXNet")?

davidbp commented 6 years ago

This is what I have:

julia> Pkg.status("MXNet")
 - MXNet                         0.2.3

julia> Pkg.versioninfo()
Julia Version 0.6.0-rc3.0
Commit ad290e9 (2017-06-07 11:53 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, haswell)
iblislin commented 6 years ago

Current stable release is v0.3.0: https://github.com/dmlc/MXNet.jl/releases

Your METADATA might out-of-date; check its version: cd ~/.julia/v0.6/METADATA && git status And verify it with Github: https://github.com/JuliaLang/METADATA.jl

davidbp commented 6 years ago

I reinstalled julia and now it's working. Thank you.

I tested the MNIST exmaple but the following line didn't work:

optimizer = mx.SGD(η=0.1, μ=0.9)
julia> optimizer = mx.SGD(η=0.1, μ=0.9)
ERROR: MethodError: no method matching MXNet.mx.SGDOptions(; η=0.1, μ=0.9)
Closest candidates are:
  MXNet.mx.SGDOptions(; lr, momentum, grad_clip, weight_decay, lr_scheduler, momentum_scheduler) at :0 got unsupported keyword arguments "η", "μ"
  MXNet.mx.SGDOptions(::Real, ::Real, ::Real, ::Real, ::Any, ::Any) at /home/david/.julia/v0.6/MXNet/src/base.jl:298 got unsupported keyword arguments "η", "μ"
  MXNet.mx.SGDOptions(::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at /home/david/.julia/v0.6/MXNet/src/base.jl:298 got unsupported keyword arguments "η", "μ"
Stacktrace:
 [1] (::Core.#kw#Type)(::Array{Any,1}, ::Type{MXNet.mx.SGDOptions}) at ./<missing>:0
 [2] (::MXNet.mx.##call#8723#8724)(::Array{Any,1}, ::Type{T} where T) at /home/david/.julia/v0.6/MXNet/src/optimizers/sgd.jl:36
 [3] (::Core.#kw#Type)(::Array{Any,1}, ::Type{MXNet.mx.SGD}) at ./<missing>:0

I simply did optimizer = mx.SGD(;lr=0.1) and it worked. Probably this line should be changed.

iblislin commented 6 years ago

Oh, mx.SGD(η=0.1, μ=0.9) is for master only. (See: https://github.com/dmlc/MXNet.jl/blob/master/NEWS.md#optimizer)

For stable version of doc: http://dmlc.ml/MXNet.jl/stable/