fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.94k stars 285 forks source link

`import PlotlyJS` crashes #2286

Open baggepinnen opened 2 years ago

baggepinnen commented 2 years ago

A simple notbook with only import PlotlyJS makes the built-in package manager go bananas, it wants to restart immediately and repeatedly image

no problem in the standard REPL image

I tried to load PlotlyJS since Plotly as backend for Plots.jl had some bugs I was hoping to workaround

Here's the error message Pluto prints in the terminal

Warning: PlutoPkg: Failed to add/remove packages! Resetting package environment...
│   PLUTO_VERSION = v"0.19.11"
│   VERSION = v"1.8.1"
│   old_packages =
│    4-element Vector{String}:
│     "RobustAndOptimalControl"
│     "ControlSystemsBase"
│     "Plots"
│     "PlotlyJS"
│   new_packages =
│    4-element Vector{String}:
│     "Plots"
│     "RobustAndOptimalControl"
│     "PlotlyJS"
│     "ControlSystemsBase"
│   exception =
│    "/tmp/jl_HuQ8VX/Project.toml": No such file
│    Stacktrace:
│      [1] error(::String, ::String)
│        @ Base ./error.jl:44
│      [2] readstring
│        @ ~/julia-1.8.1/share/julia/stdlib/v1.8/TOML/src/TOML.jl:21 [inlined]
│      [3] parsefile(f::String)
│        @ TOML ~/julia-1.8.1/share/julia/stdlib/v1.8/TOML/src/TOML.jl:43
│      [4] _modify_compat(f!::Pluto.PkgCompat.var"#29#30"{Pkg.Types.Context}, ctx::Pkg.Types.Context)
│        @ Pluto.PkgCompat ~/.julia/packages/Pluto/rBF1P/src/packages/PkgCompat.jl:429
│      [5] write_auto_compat_entries
│        @ ~/.julia/packages/Pluto/rBF1P/src/packages/PkgCompat.jl:451 [inlined]
│      [6] (::Pluto.var"#158#172"{Vector{String}, Pluto.Notebook, Pluto.IOListener})()
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:186
│      [7] withinteractive(f::Pluto.var"#158#172"{Vector{String}, Pluto.Notebook, Pluto.IOListener}, value::Bool)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:501
│      [8] #157
│        @ ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:158 [inlined]
│      [9] withio(f::Pluto.var"#157#171"{Vector{String}, Pluto.Notebook, Pluto.IOListener}, ctx::Pkg.Types.Context, io::IOContext{IOBuffer})
│        @ Pluto.PkgCompat ~/.julia/packages/Pluto/rBF1P/src/packages/PkgCompat.jl:129
│     [10] (::Pluto.var"#151#164"{Pluto.Notebook, Pluto.NotebookTopology, Pluto.IOListener, Vector{String}, Vector{String}, Bool, Bool})()
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:157
│     [11] withtoken(f::Pluto.var"#151#164"{Pluto.Notebook, Pluto.NotebookTopology, Pluto.IOListener, Vector{String}, Vector{String}, Bool, Bool}, token::Pluto.Token)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/evaluation/Tokens.jl:19
│     [12] sync_nbpkg_core(notebook::Pluto.Notebook, old_topology::Pluto.NotebookTopology, new_topology::Pluto.NotebookTopology; on_terminal_output::Pluto.var"#iocallback#182"{Pluto.ServerSession, Pluto.Notebook}, lag::Float64)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:109
│     [13] (::Pluto.var"#179#181"{Pluto.ServerSession, Pluto.Notebook, Pluto.NotebookTopology, Pluto.NotebookTopology})()
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:268
│     [14] #178
│        @ ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:259 [inlined]
│     [15] sync_nbpkg(session::Pluto.ServerSession, notebook::Pluto.Notebook, old_topology::Pluto.NotebookTopology, new_topology::Pluto.NotebookTopology; save::Bool, take_token::Bool)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/packages/Packages.jl:259
│     [16] (::Pluto.var"#258#262"{Bool, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Pluto.ServerSession, Pluto.Notebook})()
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/evaluation/Run.jl:592
│     [17] withtoken(f::Pluto.var"#258#262"{Bool, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Pluto.ServerSession, Pluto.Notebook}, token::Pluto.Token)
│        @ Pluto ~/.julia/packages/Pluto/rBF1P/src/evaluation/Tokens.jl:19
│     [18] #257
│        @ ~/.julia/packages/Pluto/rBF1P/src/evaluation/Run.jl:591 [inlined]
│     [19] macro expansion
│        @ ~/.julia/packages/Pluto/rBF1P/src/evaluation/Tokens.jl:58 [inlined]
│     [20] (::Pluto.var"#228#229"{Pluto.var"#257#261"{Bool, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Pluto.ServerSession, Pluto.Notebook}})()
disberd commented 1 year ago

I can't seem to reproduce this problem. If I fire up a new notebook and just import PlotlyJS (under Windows and latest Pluto) I don't get any errors.

The stacktrace error you showed seems to be related to the notebook you were actually testing as I see other packages there on top of PlotlyJS. Can you confirm that by just opening a new notebook in a fresh julia/pluto session you still see this behavior?

I have been importing PlotlyJS from time to time in the past months and never experienced any issue

fonsp commented 1 year ago

@baggepinnen in the example you posted, did you create a new notebook, then import PlotlyJS, or did you start with a larger notebook with more packages, and remove packages one-by-one until only PlotlyJS was left?

It would be really helpful if we could see the notebook file. If you still have this notebook file (you can search for import PlotlyJS in ~/.julia/pluto_notebooks), or if you could create a new notebook file that has this error, that would be great! You could also share the notebook privately on JuliaComputing email/slack.

baggepinnen commented 1 year ago

I tried to reproduce this problem in a new notebook but couldn't, so the problem might have been that I started with a notebook with all imports and then removed them one by one. I do get a warning in the terminal when I import PlotlyJS

Warning: The project dependencies or compat requirements have changed since the manifest was last resolved.
│ It is recommended to `Pkg.resolve()` or consider `Pkg.update()` if necessary.

Screencast from 2022-10-24 08:40:09.webm