预编译失败 StatsPlots.jl
Failed to precompile StatsPlots.jl
这可能与 this or this 有关。但是,none 的建议解决方案对我有用。
我正在使用 VSCode 和 Julia 扩展,我 运行 Jupyter notebook 中的所有内容。我的第一个单元格如下所示。
using Distributions
using StatsBase
using CSV
using DataFrames
using HypothesisTests
using Plots
using GLM
using StatsPlots
执行单元会产生以下错误。
ailed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/david/.julia/compiled/v1.7/StatsPlots/jl_27z7QU.
Stacktrace:
[1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[2] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[3] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[4] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[5] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[6] eval
@ ./boot.jl:373 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1196
[8] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[9] invokelatest
@ ./essentials.jl:714 [inlined]
[10] (::VSCodeServer.var"#150#151"{VSCodeServer.NotebookRunCellArguments, String})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:18
[11] withpath(f::VSCodeServer.var"#150#151"{VSCodeServer.NotebookRunCellArguments, String}, path::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/repl.jl:185
[12] notebook_runcell_request(conn::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::VSCodeServer.NotebookRunCellArguments)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:14
[13] dispatch_msg(x::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
@ VSCodeServer.JSONRPC ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/JSONRPC/src/typed.jl:67
[14] serve_notebook(pipename::String; crashreporting_pipename::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:94
[15] top-level scope
@ ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/notebook/notebook.jl:12
接下来,我打开了 Julia 命令行并使用 ] rm "StatsPlots"
删除了 StatsPlots 扩展并使用 ] add "StatsPlots"
重新添加它,但没有成功。我尝试在命令行中手动执行 precompile
,这会产生以下输出。
(@v1.7) pkg> precompile
Precompiling project...
✗ Arpack
✗ MultivariateStats
✗ StatsPlots
0 dependencies successfully precompiled in 11 seconds (216 already precompiled)
ERROR: The following 1 direct dependency failed to precompile:
StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]
Failed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/david/.julia/compiled/v1.7/StatsPlots/jl_1XjxNk.
ERROR: LoadError: InitError: could not load library "/home/david/.julia/artifacts/cdf6dc8aa6771a61c6c65a5a5c1a8d1b75f50a2f/lib/libarpack.so"
libopenblas64_.so: cannot open shared object file: No such file or directory
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
[2] __init__()
@ Arpack_jll ~/.julia/packages/Arpack_jll/zfgpQ/src/wrappers/x86_64-linux-gnu-libgfortran5.jl:10
[3] top-level scope (repeats 2 times)
@ none:1
during initialization of module Arpack_jll
in expression starting at /home/david/.julia/packages/Arpack/pLziT/src/Arpack.jl:2
ERROR: LoadError: Failed to precompile Arpack [7d9fca2a-8960-54d3-9f78-7d1dccf2cb97] to /home/david/.julia/compiled/v1.7/Arpack/jl_fCy8AR.
Stacktrace:
[1] include(x::String)
@ MultivariateStats ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
[2] top-level scope
@ ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:113
[3] top-level scope (repeats 2 times)
@ none:1
in expression starting at /home/david/.julia/packages/MultivariateStats/zLpz8/src/kpca.jl:3
in expression starting at /home/david/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
ERROR: LoadError: Failed to precompile MultivariateStats [6f286f6a-111f-5878-ab1e-185364afe411] to /home/david/.julia/compiled/v1.7/MultivariateStats/jl_8Rrih5.
Stacktrace:
[1] top-level scope (repeats 2 times)
@ none:1
in expression starting at /home/david/.julia/packages/StatsPlots/CpWiU/src/StatsPlots.jl:1
我尝试重新启动 Julia 内核,重新启动 VSCode,并且我尝试了我提供的第二个 link 中建议的解决方案,即删除包和 运行 gc
.
我也删除并重新添加了 MultivariateStats
和 Arpack
但上面的错误仍然存在。
可能是兴趣使然,以前有用过。我 运行 通过执行以下单元格首先陷入不同的错误。
@df data density(:Age, group = :Treatment, title = "Distribution of ages by treatment group", xlab = "Age", ylab="Distribution", legend=:topright)
以上导致出现以下错误消息。
LoadError: UndefVarError: @df not defined
可能是我不小心添加了过时的扩展程序 StatPlots
,这可能导致了上述问题。但是,我删除了旧的扩展并添加了新的。
如何解决上述问题?
编辑: 运行 Pkg.status()
生成以下输出。
(@v1.7) pkg> status
Status `~/.julia/environments/v1.7/Project.toml`
[336ed68f] CSV v0.10.2
[8f4d0f93] Conda v1.6.0
[a93c6f00] DataFrames v1.3.2
[31c24e10] Distributions v0.25.48
[38e38edf] GLM v1.6.1
[a2cc645c] GraphPlot v0.5.0
[86223c79] Graphs v1.6.0
[09f84164] HypothesisTests v0.10.6
[7073ff75] IJulia v1.23.2
[91a5bcdd] Plots v1.25.8
[c3e4b0f8] Pluto v0.18.0
[7f904dfe] PlutoUI v0.7.23
[438e738f] PyCall v1.93.0
[d330b81b] PyPlot v2.10.0
[aa4a32ff] SimpleHypergraphs v0.2.0
[2913bbd2] StatsBase v0.33.14
[f3b207a7] StatsPlots v0.14.33
我能够解决问题。问题的根源是缺少库 libopenblas64
。这可能是由于错误的 Julia 安装造成的。这是我所做的。
首先打开Julia命令行,执行下面两条命令
using Libdl
filter!(p -> occursin("blas", p), Libdl.dllist())
在我的例子中,这产生了以下输出。
1-element Array{String,1}:
"/usr/bin/../lib/libblas.so"
我在 this Github 问题中发现了类似的问题。那里也给出了正确的提示。由于我使用的是 Manjaro(基于 Arch Linux 操作系统构建),因此我使用的 Julia 安装包可能存在问题。
我删除了我的 Julia 安装并安装了官方二进制文件:julia-bin 通过执行以下命令。
yay -S julia-bin
再次打开 Julia 命令行并 运行 前两个命令。这次输出如下
julia> filter!(p -> occursin("blas", p), Libdl.dllist())
2-element Vector{String}:
"/usr/bin/../lib/julia/libopenblas64_.so"
"/usr/bin/../lib/julia/libblastrampoline.so"
现在可以按预期执行我的笔记本了。
这可能与 this or this 有关。但是,none 的建议解决方案对我有用。
我正在使用 VSCode 和 Julia 扩展,我 运行 Jupyter notebook 中的所有内容。我的第一个单元格如下所示。
using Distributions
using StatsBase
using CSV
using DataFrames
using HypothesisTests
using Plots
using GLM
using StatsPlots
执行单元会产生以下错误。
ailed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/david/.julia/compiled/v1.7/StatsPlots/jl_27z7QU.
Stacktrace:
[1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[2] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[3] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[4] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[5] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[6] eval
@ ./boot.jl:373 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1196
[8] #invokelatest#2
@ ./essentials.jl:716 [inlined]
[9] invokelatest
@ ./essentials.jl:714 [inlined]
[10] (::VSCodeServer.var"#150#151"{VSCodeServer.NotebookRunCellArguments, String})()
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:18
[11] withpath(f::VSCodeServer.var"#150#151"{VSCodeServer.NotebookRunCellArguments, String}, path::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/repl.jl:185
[12] notebook_runcell_request(conn::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::VSCodeServer.NotebookRunCellArguments)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:14
[13] dispatch_msg(x::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
@ VSCodeServer.JSONRPC ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/JSONRPC/src/typed.jl:67
[14] serve_notebook(pipename::String; crashreporting_pipename::String)
@ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/packages/VSCodeServer/src/serve_notebook.jl:94
[15] top-level scope
@ ~/.vscode/extensions/julialang.language-julia-1.5.11/scripts/notebook/notebook.jl:12
接下来,我打开了 Julia 命令行并使用 ] rm "StatsPlots"
删除了 StatsPlots 扩展并使用 ] add "StatsPlots"
重新添加它,但没有成功。我尝试在命令行中手动执行 precompile
,这会产生以下输出。
(@v1.7) pkg> precompile
Precompiling project...
✗ Arpack
✗ MultivariateStats
✗ StatsPlots
0 dependencies successfully precompiled in 11 seconds (216 already precompiled)
ERROR: The following 1 direct dependency failed to precompile:
StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]
Failed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/david/.julia/compiled/v1.7/StatsPlots/jl_1XjxNk.
ERROR: LoadError: InitError: could not load library "/home/david/.julia/artifacts/cdf6dc8aa6771a61c6c65a5a5c1a8d1b75f50a2f/lib/libarpack.so"
libopenblas64_.so: cannot open shared object file: No such file or directory
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
[2] __init__()
@ Arpack_jll ~/.julia/packages/Arpack_jll/zfgpQ/src/wrappers/x86_64-linux-gnu-libgfortran5.jl:10
[3] top-level scope (repeats 2 times)
@ none:1
during initialization of module Arpack_jll
in expression starting at /home/david/.julia/packages/Arpack/pLziT/src/Arpack.jl:2
ERROR: LoadError: Failed to precompile Arpack [7d9fca2a-8960-54d3-9f78-7d1dccf2cb97] to /home/david/.julia/compiled/v1.7/Arpack/jl_fCy8AR.
Stacktrace:
[1] include(x::String)
@ MultivariateStats ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
[2] top-level scope
@ ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:113
[3] top-level scope (repeats 2 times)
@ none:1
in expression starting at /home/david/.julia/packages/MultivariateStats/zLpz8/src/kpca.jl:3
in expression starting at /home/david/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
ERROR: LoadError: Failed to precompile MultivariateStats [6f286f6a-111f-5878-ab1e-185364afe411] to /home/david/.julia/compiled/v1.7/MultivariateStats/jl_8Rrih5.
Stacktrace:
[1] top-level scope (repeats 2 times)
@ none:1
in expression starting at /home/david/.julia/packages/StatsPlots/CpWiU/src/StatsPlots.jl:1
我尝试重新启动 Julia 内核,重新启动 VSCode,并且我尝试了我提供的第二个 link 中建议的解决方案,即删除包和 运行 gc
.
我也删除并重新添加了 MultivariateStats
和 Arpack
但上面的错误仍然存在。
可能是兴趣使然,以前有用过。我 运行 通过执行以下单元格首先陷入不同的错误。
@df data density(:Age, group = :Treatment, title = "Distribution of ages by treatment group", xlab = "Age", ylab="Distribution", legend=:topright)
以上导致出现以下错误消息。
LoadError: UndefVarError: @df not defined
可能是我不小心添加了过时的扩展程序 StatPlots
,这可能导致了上述问题。但是,我删除了旧的扩展并添加了新的。
如何解决上述问题?
编辑: 运行 Pkg.status()
生成以下输出。
(@v1.7) pkg> status
Status `~/.julia/environments/v1.7/Project.toml`
[336ed68f] CSV v0.10.2
[8f4d0f93] Conda v1.6.0
[a93c6f00] DataFrames v1.3.2
[31c24e10] Distributions v0.25.48
[38e38edf] GLM v1.6.1
[a2cc645c] GraphPlot v0.5.0
[86223c79] Graphs v1.6.0
[09f84164] HypothesisTests v0.10.6
[7073ff75] IJulia v1.23.2
[91a5bcdd] Plots v1.25.8
[c3e4b0f8] Pluto v0.18.0
[7f904dfe] PlutoUI v0.7.23
[438e738f] PyCall v1.93.0
[d330b81b] PyPlot v2.10.0
[aa4a32ff] SimpleHypergraphs v0.2.0
[2913bbd2] StatsBase v0.33.14
[f3b207a7] StatsPlots v0.14.33
我能够解决问题。问题的根源是缺少库 libopenblas64
。这可能是由于错误的 Julia 安装造成的。这是我所做的。
首先打开Julia命令行,执行下面两条命令
using Libdl
filter!(p -> occursin("blas", p), Libdl.dllist())
在我的例子中,这产生了以下输出。
1-element Array{String,1}:
"/usr/bin/../lib/libblas.so"
我在 this Github 问题中发现了类似的问题。那里也给出了正确的提示。由于我使用的是 Manjaro(基于 Arch Linux 操作系统构建),因此我使用的 Julia 安装包可能存在问题。
我删除了我的 Julia 安装并安装了官方二进制文件:julia-bin 通过执行以下命令。
yay -S julia-bin
再次打开 Julia 命令行并 运行 前两个命令。这次输出如下
julia> filter!(p -> occursin("blas", p), Libdl.dllist())
2-element Vector{String}:
"/usr/bin/../lib/julia/libopenblas64_.so"
"/usr/bin/../lib/julia/libblastrampoline.so"
现在可以按预期执行我的笔记本了。