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

Support for rendering inside VSCode #156

Closed
jc9677 opened this issue Oct 27, 2023 · 8 comments
Closed

Support for rendering inside VSCode #156

jc9677 opened this issue Oct 27, 2023 · 8 comments

Comments

@jc9677
Copy link

jc9677 commented Oct 27, 2023

Hi, I'm really looking forward to playing with lonboard but I can't get viz to to render. I've tried the two example notebooks... They render in your Binder and Colab links, but when I try them in local Jupyter, nothing gets displayed but a blank white bar in the cell output. The objects returned from viz seem valid -- I can see coordinates etc when I print them as a string. I assume there might be a widget support issue or something like that. I'm using conda to create env's on a Windows machine. Tried various python 3 versions, tried upgrading/downgrading Jupyter-related packages but no luck so far. Also tried upgrading & downgrading pyogrio, lonboard, pyarrow...

@kylebarron
Copy link
Member

You could look for errors in the browser console (right click and choose inspect to open). Alternatively it could be an issue in your Python-jupyter environment setup. You should also try reloading the page, not just the jupyter kernel, if you haven't done that yet.

@jc9677
Copy link
Author

jc9677 commented Oct 27, 2023

The Jupyter logs below are from the cell in question in north-america-roads.ipynb
(map_ = viz(gdf.geometry, width_min_pixels=0.8)
map_ ).

Unfortunately I don't know how to trace the cause. Hoping something stands out for you.

16:41:30.200 [info] Handle Execution of Cells 14 for ~\LONBOARD\north-america-roads.ipynb
16:41:30.203 [info] Kernel acknowledged execution of cell 14 @ 1698439290202
16:41:30.499 [info] End cell 14 execution @ 1698439290327, started @ 1698439290202, elapsed time = 0.125s
16:41:30.970 [info] �[32mFetch Script for {"moduleName":"anywidget","moduleVersion":"0.6.5","requestId":"anywidget:0.6.5:1698439290969"}
16:41:30.970 [info] �[32mFetch Script for anywidget
16:41:30.970 [info] �[32mSearching for Widget Script anywidget#0.6.5 using cdns jsdelivr.com unpkg.com
16:41:31.116 [info] �[32mWidget Script anywidget#0.6.5 found at URI: https://cdn.jsdelivr.net/npm/anywidget@0.6.5/dist/index.js
16:41:31.117 [info] Script source for Widget anywidget@0.6.5 was found from source cdn
16:41:31.117 [info] �[32mScript for anywidget, is https://cdn.jsdelivr.net/npm/anywidget@0.6.5/dist/index.js from cdn
16:41:31.126 [warn] Failed to extract require.config from widget for anywidget from ~.vscode-insiders\extensions\ms-toolsai.jupyter-2023.8.1002501831-win32-x64\temp\scripts\e13283a2642f4b869dfd0df99572879ed545f813d17b35b964886c57b19f89d5\jupyter\nbextensions\anywidget\extension.js
16:41:31.134 [info] �[32mFetch Script for anywidget
16:41:31.134 [info] Script source for Widget anywidget@0.6.5 was found from source cdn
16:41:31.134 [info] �[32mScript for anywidget, is https://cdn.jsdelivr.net/npm/anywidget@0.6.5/dist/index.js from cdn
16:41:31.235 [error] Widget Error: Error: Failed to render widget b4cf712541304e54b473db411c1906c3, TypeError: Cannot read properties of undefined (reading 'widget_manager')

When I run the cell a second time:

16:42:49.007 [info] Handle Execution of Cells 14 for ~\LONBOARD\north-america-roads.ipynb
16:42:49.038 [info] Kernel acknowledged execution of cell 14 @ 1698439369035
16:42:49.099 [error] Widget load failure {} {
className: 'LayoutModel',
moduleName: '@jupyter-widgets/base',
moduleVersion: '2.0.0',
cdnsUsed: false,
isOnline: true,
timedout: false,
error: '{}'
}
16:42:49.315 [info] End cell 14 execution @ 1698439369135, started @ 1698439369035, elapsed time = 0.1s
16:42:49.923 [error] Widget Error: Error: Failed to render widget ecabd564fb5149948f0fe848c57b0714, TypeError: Cannot read properties of undefined (reading 'widget_manager')
`

@kylebarron
Copy link
Member

16:41:31.126 [warn] Failed to extract require.config from widget for anywidget from ~.vscode-insiders\extensions\ms-toolsai.jupyter-2023.8.1002501831-win32-x64\temp\scripts\e13283a2642f4b869dfd0df99572879ed545f813d17b35b964886c57b19f89d5\jupyter\nbextensions\anywidget\extension.js

You're not in Jupyter, you're in VSCode. VSCode is not currently supported

@kylebarron kylebarron changed the title Can't get viz to render Support for rendering inside VSCode Oct 27, 2023
@jc9677
Copy link
Author

jc9677 commented Oct 27, 2023

Sorry, I had initially mentioned VS Code while drafting the issue but I reworded things and forgot to put it back in. I did try Jupyter in a dedicated env (not tied to VS Code in any way) and couldn't render there either but that must have been a different problem. I will give it another go outside of VS Code. Thanks Kyle!

@manzt
Copy link

manzt commented Nov 6, 2023

anywidget should work in VSCode environments. If i get the chance, i can dig into the devtools to try to see what's going on

@kylebarron
Copy link
Member

Actually it looks like it's fixed on main, so it was probably fixed by #199

image image

@kylebarron
Copy link
Member

Yep, I can confirm this was fixed by #199. If I rewind before that commit, I get the following error, which is the same as what was described in manzt/anywidget#369.

image

I'll make a new release sometime this week

@jaanli
Copy link

jaanli commented Feb 14, 2024

Ran into this as well -- had to restart the Jupyter kernel in case anyone else is running into this!

This is the library I've been waiting for!!!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants