JuliaBox.com: jupyter-js-widgets/extension "incompatible"(?) breaks Interact/Reactive

While on my local Julia/IJulia (0.6…) I have no problem, JuliaBox.com (same kernel version) fails evaluating the code snippet below, returning a lot of errors (also reported below).

From the “jupyter” of JuliaBox.com (Edit —> nbextensions config), I see that jupyter-js-widgets/extension is indicated as possibly incompatible. Maybe that is the reason behind this problem… (as Interact uses explicitly the widgets), but I have no idea how to solve it.

I indicate this as “Off topic” as I believe it might be jupyter’s and not julia’s fault.

using PyPlot
using Interact
using Reactive

fig = figure("Test")

x = linspace(-40,40,500)

@manipulate for a=-1:0.1:1; withfig(fig) do
plot(x, sin.(x)./x + a)
ax = gca()
ax[:set_ylim]((-1.5,1.5))  
end
end```


----8<-------8<------------
Error message from JuliaBox.com upon evaluating the above code in a cell:

> MethodError: no method matching IJulia.CommManager.Comm(::String, ::String, ::Bool, ::IJulia.CommManager.#noop_callback, ::IJulia.CommManager.#noop_callback; data=Dict{Symbol,Any}(Pair{Symbol,Any}(:state, Dict{Symbol,Any}(Pair{Symbol,Any}(:_model_module_version, "1.0.0"),Pair{Symbol,Any}(:_view_name, "SelectionSliderView"),Pair{Symbol,Any}(:_model_name, "SelectionSliderModel"),Pair{Symbol,Any}(:_view_module, "@jupyter-widgets/controls"),Pair{Symbol,Any}(:_model_module, "@jupyter-widgets/controls"),Pair{Symbol,Any}(:_view_module_version, "1.0.0"))),Pair{Symbol,Any}(:tooltips, Any[]),Pair{Symbol,Any}(:orientation, "horizontal")), metadata=Dict(:version=>"2.0"))
> Closest candidates are:
>   IJulia.CommManager.Comm(::Any, ::Any, ::Any, ::Any, ::Any; data) at /opt/julia_packages/.julia/v0.6/IJulia/src/comm_manager.jl:36 got unsupported keyword argument "metadata"
>   IJulia.CommManager.Comm(::Any, ::Any, ::Any, ::Any) at /opt/julia_packages/.julia/v0.6/IJulia/src/comm_manager.jl:36 got unsupported keyword arguments "data", "metadata"
>   IJulia.CommManager.Comm(::Any, ::Any, ::Any) at /opt/julia_packages/.julia/v0.6/IJulia/src/comm_manager.jl:36 got unsupported keyword arguments "data", "metadata"
>   ...
> 
> Stacktrace:
>  [1] (::Core.#kw#Type)(::Array{Any,1}, ::Type{IJulia.CommManager.Comm}, ::String, ::String, ::Bool, ::Function, ::Function) at ./<missing>:0
>  [2] create_view(::Interact.Options{:SelectionSlider,Float64}) at /opt/julia_packages/.julia/v0.6/Interact/src/IJulia/setup.jl:277
>  [3] display_widget(::Interact.Options{:SelectionSlider,Float64}) at /opt/julia_packages/.julia/v0.6/Interact/src/IJulia/setup.jl:260
>  [4] metadata at /opt/julia_packages/.julia/v0.6/Interact/src/IJulia/setup.jl:183 [inlined]
>  [5] display(::IJulia.InlineDisplay, ::Interact.Options{:SelectionSlider,Float64}) at /opt/julia_packages/.julia/v0.6/IJulia/src/inline.jl:76
>  [6] display(::Interact.Options{:SelectionSlider,Float64}) at ./multimedia.jl:194

Still happening, one year later, even with a more updated code and while on Julia 1.0.0: too bad for my class.

Interact (on Julia 1.0) doesn’t rely anymore on jupyter widgets extension for the widgets so there must be some other issue. I’m not very familiar with Juiabox though and am not sure if it supports Interact already: it’d definitely be handy for classes and easy “app deployment”.

May I then very kindly ask you for a pointer on the (new) widget-less widgets in Julia?

Sure! The old documentation notebooks have been updated for the new framework (available here) and there is a new one, in the same folder, called “tutorial” which was written for the new framework so it may be good to start with that one (it goes from the very basics to building a small app in Interact). There are also docs now, in particular, if you were already using Interact before, it may make sense to primarily look at the sections:

  • Observables: as the framework for updating signals changed and we’re using Observables now
  • Widgets: to get an overview of what widgets are there
  • Deploying the app: as you can now deploy not only in Jupyter notebook but also as a standalone Blink app, in the Juno plot pane or in the browser (both in localhost or remotely from a server).
  • the “custom widgets” section may also be interesting but for more advanced use cases (it is helpful for composing different apps, so it makes sense if you want to build a large apps using as building blocks some custom reusable components).

If you have doubts / issues there is a Gizmos channel in the julialang slack to ask quick questions.

1 Like

Thanks! I have been already using the latest Interact with Julia 1.0: it works on my laptop but unfortunately not on Juliabox.

I like it because it is considerably faster than it used to be - despite the change in syntax and in the commands.

It is a pity that Juliabox does not support its full operation: it would have been terrific to continue using it for my class.

Thank you anyway

M

What error message do you get? I’ve just tried it on juliabox on my machine on a new Julia 1.0 notebook and

using Interact
slider(1:100)

gave the desired output (though I remember things not working the previous time I tried - a while ago). What error do you get now?

I’m sorry to hear that you’ve been having this problem, but as Pietro confirms, Interact does work on Juliabox.

And it has certainly worked for the last year (with maybe some minor downtime). Many classes and presentations depend on it, certainly many of the bundled tutorials also use it.

This is what I see right now on juliabox, with a julia 1.0 kernel.

1 Like

This code works on my local (IJulia) installation but not on JuliaBox:

using Plots                    
using Interact                  

function plot_my_function(x, y)
   plot(x, y, color=:black, linewidth=2, framestyle=:origin)
   xlims!(-40, 40)             
   ylims!(-1.5, 1.5)           
end

function plot_function_demo()
   a = slider(-10:1:10, label = "a")       
   x = LinRange(-40,40,500);               
   plt = Interact.@map plot_my_function(x, sin.(x.+ &a)./(x.+ &a)) 
   wdg = Widget(["a" => a])                
   @layout! wdg hbox(plt, vbox(:a))        
end

plot_function_demo()```

I get no error, just a blank cell: see below - in my other reply - the test code.

This is what I see right now on Juliabox. I’ve zoomed out a little bit, but the code is exactly what you sent. You can see that I’ve moved the slider, and the plot has moved as a result. Using 1.0 kernel.

What browser are you using? Do you have a firewall that’s interfering somehow? Maybe check your browser console to see if you are getting any errors?

Regards

Avik

Thank you for your reply and for your time.

I am using Safari under macOs (without Ad Blockers): this works with IJulia (locally) but fails as described with JuliaBox.com.

I have just tried it with Firefox (62.0.2) and I get the same empty cell.