我在vscode中使用Jupyter Notebook运行下面代码安装Plots包时报错
using Pkg
Pkg.add("Plots")
using Plots
报错如下:
Output exceeds the size limit. Open the full output data in a text editor
Resolving package versions...
No Changes to `~/JuliaStartup/Introduction-to-Julia/Project.toml`
No Changes to `~/JuliaStartup/Introduction-to-Julia/Manifest.toml`
0 dependencies successfully precompiled in 2 seconds. 113 already precompiled. 28 skipped during auto due to previous errors.
1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: ArgumentError: Package Xorg_libXau_jll [0c0b7dd1-d40b-584c-a123-a41640f87eec] is required but does not seem to be installed:
- Run `Pkg.instantiate()` to install all recorded dependencies.
Stacktrace:
[1] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1306
[2] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[3] macro expansion
@ ./loading.jl:1180 [inlined]
[4] macro expansion
@ ./lock.jl:223 [inlined]
[5] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
[6] include(mod::Module, _path::String)
@ Base ./Base.jl:419
[7] top-level scope
@ ~/.julia/packages/JLLWrappers/QpMQW/src/toplevel_generators.jl:188
[8] include
...
@ stdin:1
in expression starting at /home/huangmy/.julia/packages/Plots/B5j7d/src/animation.jl:1
in expression starting at /home/huangmy/.julia/packages/Plots/B5j7d/src/Plots.jl:1
in expression starting at stdin:1
Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/huangmy/.julia/compiled/v1.8/Plots/jl_zcv8kk.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1707
[3] compilecache
@ ./loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
运行
Pkg.precompile()
报错如下:
Output exceeds the size limit. Open the full output data in a text editor
Precompiling project...
✗ Xorg_libxcb_jll
✗ Xorg_libX11_jll
✗ Xorg_xcb_util_jll
✗ Xorg_libXext_jll
✗ Xorg_libXfixes_jll
✗ Xorg_libxkbfile_jll
✗ Xorg_libXrender_jll
✗ Xorg_xcb_util_wm_jll
✗ Xorg_xcb_util_renderutil_jll
✗ Xorg_xcb_util_image_jll
✗ Xorg_xcb_util_keysyms_jll
✗ Libglvnd_jll
✗ Xorg_libXi_jll
✗ Xorg_libXrandr_jll
✗ Xorg_xkbcomp_jll
✗ Xorg_libXcursor_jll
✗ Xorg_libXinerama_jll
✗ Cairo_jll
✗ GLFW_jll
✗ Xorg_xkeyboard_config_jll
✗ HarfBuzz_jll
✗ xkbcommon_jll
✗ libass_jll
✗ Qt5Base_jll
...
✗ FFMPEG
✗ Plots
0 dependencies successfully precompiled in 96 seconds. 113 already precompiled.
我按照 [BUG] Can’t precompile Plots · Issue #4192 · JuliaPlots/Plots.jl (github.com)中回答在~/.bashrc
中添加了如下代码修改了 JULIA_DEPOT_PATH
环境变量,在终端中运行julia
并执行using Plots
正常。
export JULIA_DEPOT_PATH="/home/huangmy/juliapkg"
但在vscode中的Jupyter Notebook中运行仍然报错,且运行
print(DEPOT_PATH)
返回的仍然是未修改的结果
["/home/huangmy/.julia", "/home/huangmy/julia/julia-1.8.5/local/share/julia", "/home/huangmy/julia/julia-1.8.5/share/julia"]
请问该如何处理?
我本地的运行环境如下:
julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 256 × Intel(R) Xeon(R) Platinum 8153 CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, skylake-avx512)
Threads: 1 on 256 virtual cores
Environment:
JULIA_DEPOT_PATH = /home/huangmy/juliapkg
JULIA_PKG_SERVER = https://mirrors.tuna.tsinghua.edu.cn/julia
另外我没有root权限,不知道有没有任何影响。