Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode notebook viewer not implemented #2989

Open
georgematheos opened this issue May 30, 2023 · 4 comments
Open

VSCode notebook viewer not implemented #2989

georgematheos opened this issue May 30, 2023 · 4 comments
Labels
enhancement Feature requests and enhancements

Comments

@georgematheos
Copy link

Consider the following 2-cell Jupyter notebook:
Cell 1:

using WGLMakie

Cell 2:

scatter(1:3, 1:3)

If I enter and run these two cells in an unsaved Jupyter notebook, in the VSCode Jupyter notebook viewer, a scatter plot is displayed.

Issue 1: If I enter and run these two cells in a Jupyter notebook saved under some filename, using the VSCode Jupyter notebook viewer, the cells appear to run, but no scatter plot is displayed. (Other times when I do this, the scatter cell appears to run indefinitely. I am not sure what the difference is between the times when the cell finishes executing without displaying anything, and when the cell appears to infinite-loop.)

Possible issue 2: If I add a cell at the top of the notebook, with the code

using JSServe
Page()

(which the documentation appears to suggest), then executing scatter(1:3, 1:3) (or any line of code which should result in a WGLMakie plot being displayed) appears to run indefinitely. (I am not sure we are supposed to add a Page, in this case, but if not perhaps this should be clarified in the documentation.)

@georgematheos
Copy link
Author

Update: Now, when I run the unsaved Jupyter notebook in the VSCode notebook viewer, the scatter call appears to infinite loop. I'm not sure what changed since when I was using this earlier.

@SimonDanisch
Copy link
Member

VSCode notebook viewer isn't tested at all with JSServe right now, so this is somewhat expected.
This will need some focused effort to make sure it works correctly.
Sadly, every notebook system has very different ways to include & render the html, so impossible to make JSServe work out of the box for every system :(

@SimonDanisch SimonDanisch changed the title WGLMakie issues in VSCode Jupyter notebook viewer VSCode notebook viewer not implemented Nov 21, 2023
@SimonDanisch SimonDanisch added the enhancement Feature requests and enhancements label Nov 21, 2023
@kbarros
Copy link
Contributor

kbarros commented Jan 3, 2024

Bummer that this is so non-standardized.

In my tests, attempts to plot to VSCode/notebook often seems to hang for a long time. If interrupted, it prints this stack trace:

InterruptException:

Stacktrace:
  [1] process_events
    @ Base [./libuv.jl:119](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/libuv.jl:119) [inlined]
  [2] wait()
    @ Base [./task.jl:996](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/task.jl:996)
  [3] yield()
    @ Base [./task.jl:875](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/task.jl:875)
  [4] get_three(screen::WGLMakie.Screen; timeout::Int64, error::Nothing)
    @ WGLMakie [~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:220](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:220)
  [5] get_three
    @ WGLMakie [~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:200](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:200) [inlined]
  [6] wait_for_display(screen::WGLMakie.Screen)
    @ WGLMakie [~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:260](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.julia/packages/WGLMakie/XT8NJ/src/display.jl:260)
  [7] display(figlike::Makie.FigureAxisPlot; backend::Module, inline::MakieCore.Automatic, update::Bool, screen_config::@Kwargs{})
    @ Makie [~/.julia/packages/Makie/Qvk4f/src/display.jl:153](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.julia/packages/Makie/Qvk4f/src/display.jl:153)
  [8] display(figlike::Makie.FigureAxisPlot)
    @ Makie [~/.julia/packages/Makie/Qvk4f/src/display.jl:130](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.julia/packages/Makie/Qvk4f/src/display.jl:130)
  [9] #invokelatest#2
    @ [./essentials.jl:887](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/essentials.jl:887) [inlined]
 [10] invokelatest
    @ [./essentials.jl:884](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/essentials.jl:884) [inlined]
 [11] (::VSCodeServer.var"#208#209"{VSCodeServer.NotebookRunCellArguments, String})()
    @ VSCodeServer [~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:48](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:48)
...
    @ VSCodeServer.JSONRPC [~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/JSONRPC/src/typed.jl:67](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/JSONRPC/src/typed.jl:67)
 [15] serve_notebook(pipename::String, outputchannel_logger::Base.CoreLogging.SimpleLogger; crashreporting_pipename::String)
    @ VSCodeServer [~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:139](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:139)
 [16] top-level scope
    @ [~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/notebook/notebook.jl:32](https://file+.vscode-resource.vscode-cdn.net/Users/kbarros/.julia/dev/Sunny/~/.vscode/extensions/julialang.language-julia-1.65.2/scripts/notebook/notebook.jl:32)

@kbarros
Copy link
Contributor

kbarros commented Jan 3, 2024

As a temporary workaround for this problem (and also maybe #3117 and #2405) is it possible for WGLMakie to detect an "unsupported context"? In this case, WGLMakie could send the figure to a fresh web browser tab, where Makie has full control? This would be a better user experience for new Julia users, who may not be familiar with WGLMakie subtleties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements
Projects
Status: No status
Development

No branches or pull requests

3 participants