我在 julia 中安装“MXNet.jl”包时遇到了一些问题。
1)我第一次尝试输入:
(v1.2) pkg> add MXNet
我明白了:
(v1.2) pkg> add MXNet
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.2/Project.toml`
[no changes]
Updating `~/.julia/environments/v1.2/Manifest.toml`
[no changes]
在这一点上,没有任何问题发生。没有抛出错误消息。好的。现在,我回到 Julia REPL 并尝试使用该模块,为此我写道:
julia> using MXNet
[ Info: Precompiling MXNet [a7949054-b901-59c6-b8e3-7238c29bf7f0]
ERROR: LoadError: LoadError: IOError: open: permission denied (EACCES)
Stacktrace:
[1] uv_error at ./libuv.jl:90 [inlined]
[2] open(::String, ::UInt16, ::UInt16) at ./filesystem.jl:81
[3] touch(::String) at ./file.jl:404
[4] top-level scope at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/base.jl:60
[5] include at ./boot.jl:328 [inlined]
[6] include_relative(::Module, ::String) at ./loading.jl:1094
[7] include at ./Base.jl:31 [inlined]
[8] include(::String) at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:25
[9] top-level scope at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:138
[10] include at ./boot.jl:328 [inlined]
[11] include_relative(::Module, ::String) at ./loading.jl:1094
[12] include(::Module, ::String) at ./Base.jl:31
[13] top-level scope at none:2
[14] eval at ./boot.jl:330 [inlined]
[15] eval(::Expr) at ./client.jl:432
[16] top-level scope at ./none:3
in expression starting at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/base.jl:57
in expression starting at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:138
ERROR: Failed to precompile MXNet [a7949054-b901-59c6-b8e3-7238c29bf7f0] to /home/gbrunini/.julia/compiled/v1.2/MXNet/Sc0jU.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
[3] _require(::Base.PkgId) at ./loading.jl:1013
[4] require(::Base.PkgId) at ./loading.jl:911
[5] require(::Module, ::Symbol) at ./loading.jl:906
以及抛出的所有这些错误消息。知道我在所有这些错误方面的局限性后,我进行了第二次尝试,其中包括以下内容......
2) 我的第二种方法是使用蛮力,因此我将 julia MXNet.jl 包的所有 github scr 文件夹复制并粘贴到我个人桌面中的给定文件夹中。这是逐个子程序、逐个文件夹完成的,直到我复制了每个文件和文件夹。所以公平地说,这个链接中的 scr 文件夹: https : //github.com/apache/incubator-mxnet/tree/master/julia/src 现在看起来非常像我的。
现在,我转到我的文件夹并继续进行,好像“MXNet.jl”是我过去使用的任何其他普通函数,所以我输入(在 julia REPL 上):
julia> include("MXNet.jl")
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:33
[2] top-level scope at /home/gbrunini/Desktop/TRABAJOS/MTI/MTI_Neural_network/MTI_ejemplo_simple_3/base.jl:55
[3] include at ./boot.jl:328 [inlined]
[4] include_relative(::Module, ::String) at ./loading.jl:1094
[5] include at ./Base.jl:31 [inlined]
[6] include(::String) at /home/gbrunini/Desktop/TRABAJOS/MTI/MTI_Neural_network/MTI_ejemplo_simple_3/MXNet.jl:25
[7] top-level scope at /home/gbrunini/Desktop/TRABAJOS/MTI/MTI_Neural_network/MTI_ejemplo_simple_3/MXNet.jl:150
[8] include at ./boot.jl:328 [inlined]
[9] include_relative(::Module, ::String) at ./loading.jl:1094
[10] include(::Module, ::String) at ./Base.jl:31
[11] include(::String) at ./client.jl:431
[12] top-level scope at REPL[1]:1
in expression starting at /home/gbrunini/Desktop/TRABAJOS/MTI/MTI_Neural_network/MTI_ejemplo_simple_3/base.jl:51
in expression starting at /home/gbrunini/Desktop/TRABAJOS/MTI/MTI_Neural_network/MTI_ejemplo_simple_3/MXNet.jl:150
它返回了所有这些错误消息。
我的假设是这个libmxnet.so有问题(我不知道那是什么......),我很想按照本文档(MXNet 安装指南)上的步骤 1-3,但我不想搞砸了,因为我真的不知道以下任何命令的作用:
sudo apt-get update
sudo apt-get install -y build-essential git ninja-build ccache libopenblas-dev libopencv-dev cmake
git clone --recursive https://github.com/apache/incubator-mxnet.git mxnet
cd mxnet
cp config/linux.cmake config.cmake # or config/linux_gpu.cmake for build with CUDA
rm -rf build
mkdir -p build && cd build
cmake -GNinja ..
cmake --build .
也不是以下任何一项对 Julia 所做的:
mkdir julia-depot
export JULIA_DEPOT_PATH=$HOME/julia/julia-depot
a) 什么是仓库?b)什么是环境变量(我在网上看了,这让我很困惑......)
export MXNET_HOME=$HOME/incubator-mxnet
export LD_LIBRARY_PATH=$HOME/incubator-mxnet/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so:$LD_PRELOAD
export PATH=$HOME/bin:$HOME/.local/bin:$HOME/julia/julia-1.0.3/bin:$PATH
export JULIA_DEPOT_PATH=$HOME/julia/julia-depot
export MXNET_HOME=$HOME/incubator-mxnet
export LD_LIBRARY_PATH=$HOME/incubator-mxnet/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so:$LD_PRELOAD
julia --color=yes --project=./ -e \
'using Pkg; \
Pkg.develop(PackageSpec(name="MXNet", path = joinpath(ENV["MXNET_HOME"], "julia")))'
我真的只想安装 MXNet.jl 并使用它。如果我将其余所有内容理解为副作用会更好,但我会接受所有正确安装,所以简而言之:
- 我有什么问题?,
- 我是否仅通过“复制和粘贴”文档步骤中的说明来修复它?
- 如果没有,我该如何安装 MXNet.jl?
- 我是否将 GPU 与 CPU(我的选项)安装混淆了?两者之间有什么变化?我认为这与这里发生的事情没有任何关系,但是......
提前非常感谢,我希望你们一切都好。
- Ubuntu 16.4
julia> versioninfo()
Julia Version 1.2.0
Commit c6da87ff4b (2019-08-20 00:03 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-2310 CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, sandybridge)
编辑:
在@Przemyslaw 之后,我安装了最新的 julia 版本 julia1.4。我希望通过这样做,写入的权限.julia
将被修复。但是,问题仍然存在。我仍然收到以下消息:
(@v1.4) pkg> add MXNet
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Updating `~/.julia/environments/v1.4/Project.toml`
[a7949054] + MXNet v1.5.0
Updating `~/.julia/environments/v1.4/Manifest.toml`
[9e28174c] + BinDeps v1.0.1
[682c06a0] + JSON v0.21.0
[a7949054] + MXNet v1.5.0
[69de0a69] + Parsers v1.0.2
[30578b45] + URIParser v0.4.1
[8ba89e20] + Distributed
[a63ad114] + Mmap
[8dfed614] + Test
julia> using MXNet
[ Info: Precompiling MXNet [a7949054-b901-59c6-b8e3-7238c29bf7f0]
ERROR: LoadError: LoadError: IOError: open: permission denied (EACCES)
Stacktrace:
[1] uv_error at ./libuv.jl:97 [inlined]
[2] open(::String, ::UInt16, ::UInt16) at ./filesystem.jl:87
[3] touch(::String) at ./file.jl:422
[4] top-level scope at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/base.jl:60
[5] include(::Module, ::String) at ./Base.jl:377
[6] include(::String) at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:25
[7] top-level scope at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:138
[8] include(::Module, ::String) at ./Base.jl:377
[9] top-level scope at none:2
[10] eval at ./boot.jl:331 [inlined]
[11] eval(::Expr) at ./client.jl:449
[12] top-level scope at ./none:3
in expression starting at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/base.jl:57
in expression starting at /home/gbrunini/.julia/packages/MXNet/XoVCW/src/MXNet.jl:138
ERROR: Failed to precompile MXNet [a7949054-b901-59c6-b8e3-7238c29bf7f0] to /home/gbrunini/.julia/compiled/v1.4/MXNet/Sc0jU_ATtl5.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922
julia> versioninfo()
Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-2310 CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, sandybridge)
所以,
- 为什么安装新的 julia 不能解决问题
.julia
? - 我安装的所有其他软件包都可以正常工作,是
MXNet.jl
唯一需要重写的软件包.julia
吗? - 问题似乎与以下几行有关:
if isempty(MXNET_LIB)
# touch this file, so that after the user properly build libmxnet, the precompiled
# MXNet.ji will be re-compiled to get MXNET_LIB properly.
touch(@__FILE__)
error("Cannot find or load libmxnet.$(Libdl.dlext). " *
"Please see the document on how to build it.")
else
include_dependency(MXNET_LIB)
end
在base.jl
MXNet.jl 的子程序中。知道这意味着什么吗?