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

Js resource access #159

Closed
beebeed opened this issue Aug 31, 2022 · 9 comments
Closed

Js resource access #159

beebeed opened this issue Aug 31, 2022 · 9 comments

Comments

@beebeed
Copy link

beebeed commented Aug 31, 2022

I am have issues in rendering ipydatagrid within your excellent mercury framework. The jupyter notebook renders the datagrid outside of mercury but when run in mercury it appears not to be able to find the .js resources.

I get the following errors

[Open Browser Console for more detailed log - Double click to close this message]
Failed to create view for 'DataGridView' from module 'ipydatagrid' with model 'DataGridModel' from module 'ipydatagrid'
TypeError: c.JupyterPhosphorPanelWidget is not a constructor
    at g._createElement (https://cdn.jsdelivr.net/npm/ipydatagrid@%5E1.1.12/dist/index.js:2:997709)

looking at the console I see the following

Failed to load resource: the server responded with a status of 404 (Not Found)
:8988/media/temp/ipydatagrid.js:1
Falling back to https://cdn.jsdelivr.net/npm/ for [ipydatagrid@^1.1.12](mailto:ipydatagrid@%5e1.1.12)

not sure how to resolve this - any suggestions?

Is it possible to make the js files static so they do not need to be downloaded?

Thanks

David

@pplonski
Copy link
Contributor

Hi @beebeed!

Thanks for reporting the issue. Is ipydatagrid working after HTML export with nbconvert?

You can try to convert the notebook:

jupyter nbconvert --to html my-notebook.ipynb

If it works, then it should work with Mercury. FYI, the ipywidgets are not working after nbconvert and can't be used with Mercury.

Your error is very similar to this one bloomberg/ipydatagrid#231

One more thought, maybe you can use Pandas DataFrame to display values and try to add some styling https://pandas.pydata.org/docs/user_guide/style.html

@beebeed
Copy link
Author

beebeed commented Aug 31, 2022

Thanks for your quick reply @pplonski
… indeed it currently does not work with nbconvert. The odd thing is that ipydatagrid DID work in mercury before I went on holiday but now it doesn’t - I can’t figure out what has changed… any ideas? Similarly with qgrid it was working but it now doesn’t. Very odd.

@beebeed
Copy link
Author

beebeed commented Aug 31, 2022

As a follow-up @pplonski I noticed there was an error before hand which relates to the source maps

DevTools failed to load source map: Could not load content for https://unpkg.com/@jupyter-widgets/html-manager@*/dist/embed-amd-render.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
I have checked the browser and it allows access to the source maps - does this point to another issue?

for your info I am using this code

from ipydatagrid import DataGrid
import numpy as np 
import pandas as pd 

df = pd.DataFrame(data=np.random.randn(5,10))
datagrid=DataGrid(df)
datagrid

I am curious of what has happened since this used to work!

many thanks

@pplonski
Copy link
Contributor

pplonski commented Sep 2, 2022

Hi @beebeed,

I've run your example code, this is what I got:
image

image

I think it is the issue with ipydatagrid.

@beebeed
Copy link
Author

beebeed commented Sep 2, 2022

So same as me @pplonski, it is just odd that I did get it working but not idea how that happened and no idea why it isn’t working now. Have reverted to using itables.

I guess the issue is the use of widgets? Do you plan / is it possible to incorporate widgets into the mercury framework? Think it would add great functionality.

@pplonski
Copy link
Contributor

pplonski commented Sep 2, 2022

@beebeed ipywidgets will not be supported in the Mercury. It has an architecture that can't support it. Sorry!

You can try to use voila - they support ipywidgets.

@pplonski
Copy link
Contributor

pplonski commented Sep 2, 2022

@beebeed, may I ask what functionality you need from the grid/tables display? Is it just to display the data? or for exploration?

@gmouawad
Copy link

gmouawad commented Jun 26, 2023

df = pd.DataFrame(data=np.random.randn(5,10))
datagrid=DataGrid(df)
datagrid

your code is showing the below message on mercury and not displaying the table:
image

@pplonski is there any fix for such issue?

@pplonski
Copy link
Contributor

@gmouawad I think there should be some display method available for data grid. If you don't find a way to display it please create a new issue.

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

3 participants