8000 Some Jupyterlite examples don't work due to missing / not found dependencies · Issue #1100 · sphinx-gallery/sphinx-gallery · GitHub
[go: up one dir, main page]

Skip to content

Some Jupyterlite examples don't work due to missing / not found dependencies #1100

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

Open
StefRe opened this issue Mar 13, 2023 · 2 comments
Open

Comments

@StefRe
Copy link
Contributor
StefRe commented Mar 13, 2023
  • plot_1_exp.ipynb
    ModuleNotFoundError: No module named 'local_module'

  • plot_2_seaborn.ipynb
    ModuleNotFoundError: No module named 'seaborn'

  • plot_6_function_identifier.ipynb
    ModuleNotFoundError: No module named 'sphinx_gallery'

  • plot_3d.ipynb
    ModuleNotFoundError: No module named 'mayavi'

  • plot_0_plotly.ipynb
    ModuleNotFoundError: No module named 'plotly'

  • plot_collisions.ipynb, plot_glyphs.ipynb, plot_lighting.ipynb, plot_ray_trace.ipynb
    ModuleNotFoundError: No module named 'pyvista'

Edit: the crossed out cases were covered by #1113

@lesteve
Copy link
Member
lesteve commented Mar 17, 2023

Thanks a lot for your feed-back! I am seeing only this now, don't hesitate to ping me directly in the future on sphinx-gallery JupyterLite-related things!

Trying to answer the issues you found:

  • plot_1_exp.ipynb
    ModuleNotFoundError: No module named 'local_module'

This one is actually an issue in Binder too (I noticed it recently while working on the JupyterLite integration). The reason is because we are not copying local_module.py in our notebooks folder. It could be a worthwhile fix although the fact that nobody complained about it seems to show that this use case does not happens that often in practice. Personally I am not planning to work on this.

  • plot_2_seaborn.ipynb
    ModuleNotFoundError: No module named 'seaborn'

Yep this is known, in #977 we focused on a MVP. You can add a %pip install seaborn cell before importing seaborn and it will work. I have some plans to implement a way to be able to modify the notebook based on its contents to add this kind of cells inside sphinx-gallery, or rather to make it configurable so that people can do what they want in conf.py

  • plot_6_function_identifier.ipynb
    ModuleNotFoundError: No module named 'sphinx_gallery'

This one is a bit special in the sense that you expect the package you write examples for to be installed. In the use case I am targetting first (scikit-learn mostly but matplotlib could be another good candidate), the package is available in Pyodide so import sklearn and import matplotlib would work. For the generic case, this needs a bit more thoughts how it could be made available inside the JupyterLite environment.

  • plot_3d.ipynb
    ModuleNotFoundError: No module named 'mayavi'

mayavi is going to be a lot more tricky because it is currently not part of Pyodide (not sure it will ever be but who knows ...) and needs to be compiled. Maybe emscripten-forge can help for packages that have a lot of compiled code and heavy dependencies.

  • plot_0_plotly.ipynb
    ModuleNotFoundError: No module named 'plotly'

%pip install plotly should work I think similarly to %pip install seaborn.

  • plot_collisions.ipynb, plot_glyphs.ipynb, plot_lighting.ipynb, plot_ray_trace.ipynb
    ModuleNotFoundError: No module named 'pyvista'

I don't know too much about pyvista but I would expect that we are in a similar case as mayavi.

@larsoner
Copy link
Contributor

mayavi is going to be a lot more tricky because it is currently not part of Pyodide (not sure it will ever be but who knows ...) and needs to be compiled. Maybe emscripten-forge can help for packages that have a lot of compiled code and heavy dependencies.

Mayavi is out of the codebase on master so I wouldn't worry about this one

I don't know too much about pyvista but I would expect that we are in a similar case as mayavi.

mayavi compiles (locally!) on pip install, pyvista does not. There the limitation will be that you also need VTK (which has wheels) and working OpenGL for 3D rendering. You can get that with an osmesa (software rendering) build some places. I think PyVista actually maintains some osmesa VTK builds somewhere. If you want me to track them down let me know and I can look...

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
0