Pluto.jl: namespace collision in bound variable name

Created on 25 Oct 2020  路  3Comments  路  Source: fonsp/Pluto.jl

I just reopened a notebook I worked on a couple of days before and when playing with the sliders Pluto becomes unresponsive at some point. This is the stacktrace displayed in the terminal:

Opening http://localhost:1234/?secret=6JAaIgC5 in your default browser... ~ have fun!

Press Ctrl+C in this terminal to stop Pluto

      From worker 2:       Updating registry at `C:\Users\felix\.julia\registries\General`
      From worker 2:      Resolving package versions...
      From worker 2:    No Changes to `D:\Google Drive\CodingPlayground\ScalarConservation\scalarConservationLaws\Project.toml`
      From worker 2:    No Changes to `D:\Google Drive\CodingPlayground\ScalarConservation\scalarConservationLaws\Manifest.toml`
      From worker 2:      Resolving package versions...
      From worker 2:    No Changes to `D:\Google Drive\CodingPlayground\ScalarConservation\scalarConservationLaws\Project.toml`
      From worker 2:    No Changes to `D:\Google Drive\CodingPlayground\ScalarConservation\scalarConservationLaws\Manifest.toml`
On worker 2:
cannot assign a value to variable Polynomials.degree from module workspace44
top-level scope at none:1
eval at .\boot.jl:331
top-level scope at none:1
eval at .\boot.jl:331
#103 at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\process_messages.jl:290
run_work_thunk at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\process_messages.jl:79
run_work_thunk at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\process_messages.jl:88
#96 at .\task.jl:356
Stacktrace:
 [1] sync_end(::Channel{Any}) at .\task.jl:314
 [2] macro expansion at .\task.jl:333 [inlined]
 [3] remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\macros.jl:218
 [4] eval_in_workspace(::Tuple{Pluto.ServerSession,Pluto.Notebook}, ::Expr) at C:\Users\felix\.julia\packages\Pluto\2pyPe\src\evaluation\WorkspaceManager.jl:259
 [5] (::Pluto.var"#custom_deletion_hook#190"{Pluto.var"#custom_deletion_hook#188#191"{Symbol,Int64}})(::Tuple{Pluto.ServerSession,Pluto.Notebook}, ::Set{Symbol}, ::Set{Tuple{Base.UUID,Array{Symbol,1}}}, ::Set{Expr}; to_run::Array{Pluto.Cell,1}) at C:\Users\felix\.julia\packages\Pluto\2pyPe\src\webserver\Dynamic.jl:191
 [6] run_reactive!(::Pluto.ServerSession, ::Pluto.Notebook, ::Pluto.NotebookTopology, ::Pluto.NotebookTopology, ::Array{Pluto.Cell,1}; deletion_hook::Function) at C:\Users\felix\.julia\packages\Pluto\2pyPe\src\evaluation\Run.jl:65      
 [7] macro expansion at C:\Users\felix\.julia\packages\Pluto\2pyPe\src\evaluation\Run.jl:13 [inlined]
 [8] (::Pluto.var"#76#78"{Base.Iterators.Pairs{Symbol,Pluto.var"#custom_deletion_hook#190"{Pluto.var"#custom_deletion_hook#188#191"{Symbol,Int64}},Tuple{Symbol},NamedTuple{(:deletion_hook,),Tuple{Pluto.var"#custom_deletion_hook#190"{Pluto.var"#custom_deletion_hook#188#191"{Symbol,Int64}}}}},Pluto.ServerSession,Pluto.Notebook,Pluto.NotebookTopology,Pluto.NotebookTopology,Array{Pluto.Cell,1}})() at .\task.jl:356

At this point changing the sliders does not update graphs and manually reevaluating the cells which would display the graphs causes the loading animation to show but it does not stop.

you can find the notebook I am using here: https://github.com/FelixBenning/ScalarConservationLaws/blob/pluto_bug_report/src/homework_1.jl

backend

Most helpful comment

It appears that my definition of

@bind degree Slider(1:length(n_vector)-1, default=1, show_value=true)

caused a name collision with Polynomials.degree which in turn caused Pluto to crash. Renaming the variable to deg fixes my problems. Nevertheless Pluto should not crash when namespace collisions happen.

The lesson I am going to take from this, is that I should never have tried out Julias using import style and trusted my gut which said that it is a terrible idea to use the python equivalent of from module import * all the time.

All 3 comments

It appears that my definition of

@bind degree Slider(1:length(n_vector)-1, default=1, show_value=true)

caused a name collision with Polynomials.degree which in turn caused Pluto to crash. Renaming the variable to deg fixes my problems. Nevertheless Pluto should not crash when namespace collisions happen.

The lesson I am going to take from this, is that I should never have tried out Julias using import style and trusted my gut which said that it is a terrible idea to use the python equivalent of from module import * all the time.

@FelixBenning yeah, Pluto has a pretty hard time with using ..., though it's the most used syntax in the Julia community 鈽癸笍
Obviously it should not crash, though, so good issue 馃憤

(Although I agree with your gut feeling, using is different from from m import * in that you are only importing the globals that the package author explicitly exported, not its internals.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aramirezreyes picture aramirezreyes  路  3Comments

kapple19 picture kapple19  路  5Comments

enuit picture enuit  路  3Comments

briochemc picture briochemc  路  6Comments

MikaelSlevinsky picture MikaelSlevinsky  路  6Comments