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

Jupyter Notebook will not render ipyaggrid. #10905

Closed
1 of 2 tasks
hayden-puckeridge opened this issue Jul 23, 2022 · 8 comments
Closed
1 of 2 tasks

Jupyter Notebook will not render ipyaggrid. #10905

hayden-puckeridge opened this issue Jul 23, 2022 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster ipywidgets Rendering, loading, saving, anything to do with IPyWidgets zmq Issues related to zmq

Comments

@hayden-puckeridge
Copy link

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

Cannot render a table widget using ipyaggrid in VS Code Jupyter Notebok.

When running the code below I have seen each of following responses:

  • Content of all the cells in the notebook disappears and a prompt appears to save the file.
  • Error popup: "Unable to find widget 'ipyaggrid' version '~0.2.2' from configured widget sources ["jsdelivr.com","unpkg.com"]. Expected behavior may be affected. Click here for more information."
  • Cell output: "Error loading preloads: could not find renderer"
import pandas as pd

d = {'col1': [1, 2], 'col2': [3, 4]}
df = pd.DataFrame(data=d)
df

from ipyaggrid import Grid

column_defs = [{'field': c} for c in df.columns]

grid_options = {
    'columnDefs' : column_defs,
}

g = Grid(grid_data=df,
         width=600,
         height=500,
         grid_options=grid_options,
         center=True)
g

Have tried with VS Code and VS Code - Insiders, also with release, pre-release and previous versions of the Jupyter extension.

ipyaggrid v0.2.2 appears to be available from jsDelivr and UNPKG.
ipyaggrid behaves as expected in notebooks outside of VS Code.

VS Code Version

Version: 1.69.2 (user setup) Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a Date: 2022-07-18T16:12:52.460Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19042

Jupyter Extension Version

v2022.6.1201981810

Jupyter logs

info 23:7:12.440: Preferred Remote kernel for c:\Users\***\Untitled.ipynb is undefined
info 23:7:12.456: Preferred Remote kernel for c:\Users\***\Untitled.ipynb is undefined
info 23:7:12.457: Find preferred kernel for c:\Users\***\Untitled.ipynb with metadata {"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.9.12"},"vscode":{"interpreter":{"hash":"b0381650795492daa6e76ff104d734f3137a87c8f36c2eb4c4568bd13c4fda5f"}}} & preferred interpreter c:\Users\***\Anaconda3\python.exe
info 23:7:12.460: Preferred Remote kernel for c:\Users\***\Untitled.ipynb is undefined
info 23:7:12.460: Preferred kernel .jvsc74a57bd0b0381650795492daa6e76ff104d734f3137a87c8f36c2eb4c4568bd13c4fda5f.c:\Users\***\Anaconda3\python.exe.c:\Users\***\Anaconda3\python.exe.-m#ipykernel_launcher is exact match
info 23:7:12.461: PreferredConnection: .jvsc74a57bd0b0381650795492daa6e76ff104d734f3137a87c8f36c2eb4c4568bd13c4fda5f.c:\Users\***\Anaconda3\python.exe.c:\Users\***\Anaconda3\python.exe.-m#ipykernel_launcher found for NotebookDocument: c:\Users\***\Untitled.ipynb
info 23:7:12.492: Hiding xeus kernelspec
info 23:7:12.492: Hiding xeus kernelspec
info 23:7:12.495: Hiding xeus kernelspec
info 23:7:12.495: Hiding xeus kernelspec
info 23:7:12.499: Preferred Remote kernel for c:\Users\***\Untitled.ipynb is undefined
info 23:7:12.499: Find preferred kernel for c:\Users\***\Untitled.ipynb with metadata {"kernelspec":{"display_name":"Python 3 (ipykernel)","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.9.12"},"vscode":{"interpreter":{"hash":"b0381650795492daa6e76ff104d734f3137a87c8f36c2eb4c4568bd13c4fda5f"}}} & preferred interpreter c:\Users\***\Anaconda3\python.exe
info 23:7:12.501: Preferred Remote kernel for c:\Users\***\Untitled.ipynb is undefined
info 23:7:12.501: Preferred kernel .jvsc74a57bd0b0381650795492daa6e76ff104d734f3137a87c8f36c2eb4c4568bd13c4fda5f.c:\Users\***\Anaconda3\python.exe.c:\Users\***\Anaconda3\python.exe.-m#ipykernel_launcher is exact match
info 23:7:12.782: Registering dummy command feature

Coding Language and Runtime Version

Python v3.9.12

Language Extension Version (if applicable)

Python v2022.10.1

Anaconda Version (if applicable)

4.13.0

Running Jupyter locally or remotely?

Local

@hayden-puckeridge hayden-puckeridge added bug Issue identified by VS Code Team member as probable bug triage-needed Issue needs to be triaged labels Jul 23, 2022
@amunger
Copy link
Contributor

amunger commented Jul 25, 2022

thanks for the bug, aside from the direct issue with the widget rendering, this seems to also expose some issues with error handling in core.

  • The open editor crashes and offers a save prompt, but the save operation seems to fail -> potential data loss
  • The Jupyter logs seem to clear when the editor crashes, so diagnosing would be tough from bug reports (except that I have a repro)
  • Sometimes the editor doesn't actually close after it has crashed, it's just no longer useable
  • when re-opening the editor, the inputs don't appear, so there's still issues with that notebook until it is closed cleanly:

image

@amunger amunger added the ipywidgets Rendering, loading, saving, anything to do with IPyWidgets label Jul 25, 2022
@amunger
Copy link
Contributor

amunger commented Jul 25, 2022

it looks like the issue I was hitting was due to a known zmq crash: #10386 (comment), and after disabling zmq, it seems to work fine:
"jupyter.disableZMQSupport": true

can you open developer tools Developer: toggle developer tools, and provide any errors you see there after trying to load the widget?

@amunger amunger added the info-needed Issue requires more information from poster label Jul 25, 2022
@rebornix
Copy link
Member

Sometimes the editor doesn't actually close after it has crashed, it's just no longer useable
when re-opening the editor, the inputs don't appear, so there's still issues with that notebook until it is closed cleanly:

CodeEditorWidget doesn't allow text model to be used after it gets disposed and when the extension host died, the text models for cells are not cleared but only disposed, leading to the weird UX that the notebook can be reopen but none of the cells are rendered in cell editors properly.

We need to think about how to improve this experience.

@rchiodo
Copy link
Contributor

rchiodo commented Jul 25, 2022

My guess is we're not looking for the right file. ipyaggrid exports this:

image

In our code we look for index.js, not index.min.js.

@greazer greazer added specific-to-package-library and removed triage-needed Issue needs to be triaged labels Jul 25, 2022
@hayden-puckeridge
Copy link
Author

Thanks for the response. See attached the error log from the dev console when running the sample code, followed by the editor crashing, cells clearing and unsuccessful save prompt.

vscode-app-1658819761443.log

@amunger
Copy link
Contributor

amunger commented Jul 27, 2022

@hayden-puckeridge - those symptoms sound like the zmq crash. Can you try disabling zmq by adding "jupyter.disableZMQSupport": true to your settings json and check if it still repros (and provide the dev console logs again if the result is still bad but different)

@hayden-puckeridge
Copy link
Author

@amunger Thanks, with zmq disabled the widgets render correctly with no issues that I can see.

@DonJayamanne DonJayamanne added zmq Issues related to zmq upstream-zmq labels Jul 28, 2022
@amunger
Copy link
Contributor

amunger commented Jul 28, 2022

thanks for the update, I'll just close this one as a dupe of #10386 then

@amunger amunger closed this as completed Jul 28, 2022
@amunger amunger removed the bug Issue identified by VS Code Team member as probable bug label Jul 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ipywidgets Rendering, loading, saving, anything to do with IPyWidgets zmq Issues related to zmq
Projects
None yet
Development

No branches or pull requests

6 participants