GR.jl icon indicating copy to clipboard operation
GR.jl copied to clipboard

Precompilation fails only in Jupyter notebook

Open cocoa1231 opened this issue 3 years ago • 7 comments

Hello

I'm trying to import Plots in a jupyter notebook and for some reason, with a fresh environment (created a new .julia directory) and it runs fine in the command line, but when importing in Jupyter for some reason it fails.

┌ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
└ @ Base loading.jl:1423
ERROR: LoadError: ArgumentError: Package GR does not have RelocatableFolders in its dependencies:
- If you have GR checked out for development and have
  added RelocatableFolders as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with GR
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] include
   @ ./Base.jl:418 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
   @ Base ./loading.jl:1318
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:373 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:453
 [7] top-level scope
   @ none:1
in expression starting at /home/cocoadebian/.julia/packages/GR/KPElO/src/GR.jl:2
ERROR: LoadError: Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to /home/cocoadebian/.julia/compiled/v1.7/GR/jl_j1MQ1F.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include(mod::Module, _path::String)
[](http://localhost:8889/lab/tree/Documents/College/Year3/CompPhys/DarkMatterProject/JuliaCode/Project.ipynb#Computational-Physics---Dark-Matter)Computational Physics - Dark Matter

using Plots

using LaTeXStrings

using QuadGK

┌ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
└ @ Base loading.jl:1423
ERROR: LoadError: ArgumentError: Package GR does not have RelocatableFolders in its dependencies:
- If you have GR checked out for development and have
  added RelocatableFolders as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with GR
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] include
   @ ./Base.jl:418 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
   @ Base ./loading.jl:1318
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:373 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:453
 [7] top-level scope
   @ none:1
in expression starting at /home/cocoadebian/.julia/packages/GR/KPElO/src/GR.jl:2
ERROR: LoadError: Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to /home/cocoadebian/.julia/compiled/v1.7/GR/jl_j1MQ1F.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [8] include(x::String)
    @ Plots ~/.julia/packages/Plots/YAlrZ/src/Plots.jl:1
  [9] top-level scope
    @ ~/.julia/packages/Plots/YAlrZ/src/Plots.jl:235
 [10] include
    @ ./Base.jl:418 [inlined]
 [11] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1318
 [12] top-level scope
    @ none:1
 [13] eval
    @ ./boot.jl:373 [inlined]
 [14] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [15] top-level scope
    @ none:1
in expression starting at /home/cocoadebian/.julia/packages/Plots/YAlrZ/src/backends/gr.jl:6
in expression starting at /home/cocoadebian/.julia/packages/Plots/YAlrZ/src/Plots.jl:1

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/cocoadebian/.julia/compiled/v1.7/Plots/jl_4sONzV.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

I'm running on Debian Unstable with Julia 1.7.1. Could somebody prompt me in the right direction? Thank you!

cocoa1231 avatar Feb 04 '22 08:02 cocoa1231

I just tested the same in a Pluto notebook and the import succeeds however no plots show up

cocoa1231 avatar Feb 04 '22 08:02 cocoa1231

Here is package status

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [7073ff75] IJulia v1.23.2
  [b964fa9f] LaTeXStrings v1.3.0
  [91a5bcdd] Plots v1.25.7
  [c3e4b0f8] Pluto v0.17.7
  [1fd47b50] QuadGK v2.4.2

cocoa1231 avatar Feb 04 '22 08:02 cocoa1231

Could you please (manually) add, build and test GR?

] add GR
] build GR
] test GR
using GR
plot(randn(10))

jheinen avatar Feb 04 '22 09:02 jheinen

It seems to work only on the REPL, not on jupyter or pluto.

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.7.1 (2021-12-22)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.7) pkg> add GR
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/.julia/environments/v1.7/Project.toml`
  [28b8d3ca] + GR v0.63.1
  No Changes to `~/.julia/environments/v1.7/Manifest.toml`

(@v1.7) pkg> build GR
    Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/4a740db447aae0fbeb3ee730de1afbb14ac798a1/build.log`
Precompiling project...
  2 dependencies successfully precompiled in 43 seconds (138 already precompiled)

(@v1.7) pkg> test GR
     Testing GR
      Status `/tmp/jl_BOBdnZ/Project.toml`
  [28b8d3ca] GR v0.63.1
  [cd3eb016] HTTP v0.9.17
  [682c06a0] JSON v0.21.2
  [05181044] RelocatableFolders v0.1.3
  [d2c73de3] GR_jll v0.63.1+0
  [2a0f44e3] Base64 `@stdlib/Base64`
  [8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles`
  [8f399da3] Libdl `@stdlib/Libdl`
  [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
  [44cfe95a] Pkg `@stdlib/Pkg`
  [de0858da] Printf `@stdlib/Printf`
  [9a3f8284] Random `@stdlib/Random`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [6462fe0b] Sockets `@stdlib/Sockets`
  [8dfed614] Test `@stdlib/Test`
  [cf7118a7] UUIDs `@stdlib/UUIDs`
      Status `/tmp/jl_BOBdnZ/Manifest.toml`
  [28b8d3ca] GR v0.63.1
  [cd3eb016] HTTP v0.9.17
  [83e8ac13] IniFile v0.5.0
  [692b3bcd] JLLWrappers v1.4.1
  [682c06a0] JSON v0.21.2
  [739be429] MbedTLS v1.0.3
  [69de0a69] Parsers v2.2.1
  [21216c6a] Preferences v1.2.3
  [05181044] RelocatableFolders v0.1.3
  [6c6a2e73] Scratch v1.1.0
  [5c2747f8] URIs v1.3.0
  [6e34b625] Bzip2_jll v1.0.8+0
  [83423d85] Cairo_jll v1.16.1+1
  [2e619515] Expat_jll v2.2.10+0
  [b22a6f82] FFMPEG_jll v4.4.0+0
  [a3f928ae] Fontconfig_jll v2.13.93+0
  [d7e528f0] FreeType2_jll v2.10.4+0
  [559328eb] FriBidi_jll v1.0.10+0
  [0656b61e] GLFW_jll v3.3.6+0
  [d2c73de3] GR_jll v0.63.1+0
  [78b55507] Gettext_jll v0.21.0+0
  [7746bdde] Glib_jll v2.68.3+2
  [3b182d85] Graphite2_jll v1.3.14+0
  [2e76f6c2] HarfBuzz_jll v2.8.1+1
  [aacddb02] JpegTurbo_jll v2.1.0+0
  [c1c5ebd0] LAME_jll v3.100.1+0
  [dd4b983a] LZO_jll v2.10.1+0
  [e9f186c6] Libffi_jll v3.2.2+1
  [d4300ac3] Libgcrypt_jll v1.8.7+0
  [7e76a0d4] Libglvnd_jll v1.3.0+3
  [7add5ba3] Libgpg_error_jll v1.42.0+0
  [94ce4f54] Libiconv_jll v1.16.1+1
  [4b2f31a3] Libmount_jll v2.35.0+0
  [89763e89] Libtiff_jll v4.3.0+0
  [38a345b3] Libuuid_jll v2.36.0+0
  [e7412a2a] Ogg_jll v1.3.5+1
  [458c3c95] OpenSSL_jll v1.1.13+0
  [91d4177d] Opus_jll v1.3.2+0
  [2f80f16e] PCRE_jll v8.44.0+0
  [30392449] Pixman_jll v0.40.1+0
  [ea2cea3b] Qt5Base_jll v5.15.3+0
  [a2964d1f] Wayland_jll v1.19.0+0
  [2381bf8a] Wayland_protocols_jll v1.23.0+0
  [02c8fc9c] XML2_jll v2.9.12+0
  [aed1982a] XSLT_jll v1.1.34+0
  [4f6342f7] Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] Xorg_libXau_jll v1.0.9+4
  [935fb764] Xorg_libXcursor_jll v1.2.0+4
  [a3789734] Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] Xorg_libXext_jll v1.3.4+4
  [d091e8ba] Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] Xorg_libXi_jll v1.7.10+4
  [d1454406] Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] Xorg_libXrandr_jll v1.5.2+4
  [ea2f1a96] Xorg_libXrender_jll v0.9.10+4
  [14d82f49] Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] Xorg_libxcb_jll v1.13.0+3
  [cc61e674] Xorg_libxkbfile_jll v1.1.0+4
  [12413925] Xorg_xcb_util_image_jll v0.4.0+1
  [2def613f] Xorg_xcb_util_jll v0.4.0+1
  [975044d2] Xorg_xcb_util_keysyms_jll v0.4.0+1
  [0d47668e] Xorg_xcb_util_renderutil_jll v0.3.9+1
  [c22f9ab0] Xorg_xcb_util_wm_jll v0.4.1+1
  [35661453] Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] Xorg_xkeyboard_config_jll v2.27.0+4
  [c5fb5394] Xorg_xtrans_jll v1.4.0+3
  [3161d3a3] Zstd_jll v1.5.0+0
  [0ac62f75] libass_jll v0.15.1+0
  [f638f0a6] libfdk_aac_jll v2.0.2+0
  [b53b4c65] libpng_jll v1.6.38+0
  [f27f6e37] libvorbis_jll v1.3.7+1
  [1270edf5] x264_jll v2021.5.5+0
  [dfaa095f] x265_jll v3.5.0+0
  [d8fb68d0] xkbcommon_jll v0.9.1+5
  [0dad84c5] ArgTools `@stdlib/ArgTools`
  [56f22d72] Artifacts `@stdlib/Artifacts`
  [2a0f44e3] Base64 `@stdlib/Base64`
  [ade2ca70] Dates `@stdlib/Dates`
  [8bb1440f] DelimitedFiles `@stdlib/DelimitedFiles`
  [f43a241f] Downloads `@stdlib/Downloads`
  [b77e0a4c] InteractiveUtils `@stdlib/InteractiveUtils`
  [b27032c2] LibCURL `@stdlib/LibCURL`
  [76f85450] LibGit2 `@stdlib/LibGit2`
  [8f399da3] Libdl `@stdlib/Libdl`
  [37e2e46d] LinearAlgebra `@stdlib/LinearAlgebra`
  [56ddb016] Logging `@stdlib/Logging`
  [d6f4376e] Markdown `@stdlib/Markdown`
  [a63ad114] Mmap `@stdlib/Mmap`
  [ca575930] NetworkOptions `@stdlib/NetworkOptions`
  [44cfe95a] Pkg `@stdlib/Pkg`
  [de0858da] Printf `@stdlib/Printf`
  [3fa0cd96] REPL `@stdlib/REPL`
  [9a3f8284] Random `@stdlib/Random`
  [ea8e919c] SHA `@stdlib/SHA`
  [9e88b42a] Serialization `@stdlib/Serialization`
  [6462fe0b] Sockets `@stdlib/Sockets`
  [fa267f1f] TOML `@stdlib/TOML`
  [a4e569a6] Tar `@stdlib/Tar`
  [8dfed614] Test `@stdlib/Test`
  [cf7118a7] UUIDs `@stdlib/UUIDs`
  [4ec0a83e] Unicode `@stdlib/Unicode`
  [e66e0078] CompilerSupportLibraries_jll `@stdlib/CompilerSupportLibraries_jll`
  [deac9b47] LibCURL_jll `@stdlib/LibCURL_jll`
  [29816b5a] LibSSH2_jll `@stdlib/LibSSH2_jll`
  [c8ffd9c3] MbedTLS_jll `@stdlib/MbedTLS_jll`
  [14a3606d] MozillaCACerts_jll `@stdlib/MozillaCACerts_jll`
  [4536629a] OpenBLAS_jll `@stdlib/OpenBLAS_jll`
  [83775a58] Zlib_jll `@stdlib/Zlib_jll`
  [8e850b90] libblastrampoline_jll `@stdlib/libblastrampoline_jll`
  [8e850ede] nghttp2_jll `@stdlib/nghttp2_jll`
  [3f19e933] p7zip_jll `@stdlib/p7zip_jll`
     Testing Running tests...
[ Info: Testing plot: Simple line plot
[ Info: Testing plot: Scatter plot
[ Info: Testing plot: Colored scatter plot
[ Info: Testing plot: Stem plot
[ Info: Testing plot: Histogram plot
[ Info: Testing plot: Multi-line plot
[ Info: Testing plot: Overlay plot
[ Info: Testing plot: 3-d line plot
[ Info: Testing plot: Polar plot
[ Info: Testing plot: 3-d point plot
[ Info: Testing plot: Colored 3-d point plot
[ Info: Testing plot: Hexbin plot
[ Info: Testing plot: Contour plot
[ Info: Testing plot: Contour plot of matrix
[ Info: Testing plot: Filled contour plot
[ Info: Testing plot: Filled contour plot of matrix
[ Info: Testing plot: Filled contour plot on a triangular mesh
[ Info: Testing plot: Surface plot
[ Info: Testing plot: Surface plot of matrix
[ Info: Testing plot: Surface plot on a triangular mesh
[ Info: Testing plot: Wireframe plot
[ Info: Testing plot: Wireframe plot of matrix
[ Info: Testing plot: Heatmap plot
[ Info: Testing plot: Image plot
[ Info: Testing plot: Isosurface plot
[ Info: Testing plot: Shade points
[ Info: Testing plot: Discrete plot
 15.452319 seconds (43.56 M allocations: 2.342 GiB, 5.58% gc time, 89.35% compilation time)
     Testing GR tests passed 

julia> plot(randn(10))
ERROR: UndefVarError: plot not defined
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

julia> using GR

julia> plot(randn(10))

If I run jupyter lab's console with the IJulia kernel I get this error when I do using GR

┌ Info: Precompiling GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71]
└ @ Base loading.jl:1423
ERROR: LoadError: ArgumentError: Package GR does not have RelocatableFolders in its dependencies:
- If you have GR checked out for development and have
  added RelocatableFolders as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with GR
Stacktrace:
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:980
 [2] include
   @ ./Base.jl:418 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1318
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:373 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:453
 [7] top-level scope
   @ none:1
in expression starting at /home/cocoadebian/.julia/packages/GR/KPElO/src/GR.jl:2
Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to /home/cocoadebian/.julia/compiled/v1.7/GR/jl_sRBOCL.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

cocoa1231 avatar Feb 04 '22 10:02 cocoa1231

Should I report this with Pluto and Jupyter rather than GR?

cocoa1231 avatar Feb 04 '22 10:02 cocoa1231

Yes. I don't think I can help here.

jheinen avatar Feb 04 '22 10:02 jheinen

Did you run Pkg.resolve() as it suggested? Your Manifest.toml is somehow out of sync with the package.

mkitti avatar Mar 18 '22 14:03 mkitti