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

Reducing default set of packages #11

Closed
asmeurer opened this issue May 10, 2022 · 5 comments · Fixed by #19
Closed

Reducing default set of packages #11

asmeurer opened this issue May 10, 2022 · 5 comments · Fixed by #19

Comments

@asmeurer
Copy link
Member

I noticed that matplotlib and numpy are always loaded by default, if I understand the console output correctly.

Can we make it so that they are not loaded by default? It seems that most packages work like this, where if you import something like scipy it loads it. That would presumably make the initial loading time faster.

@jtpio
Copy link
Contributor

jtpio commented Apr 24, 2023

I think this is likely fixed in the latest versions of the jupyterlite-core and jupyterlite-pyodide-kernel packages.

The relevant PR being jupyterlite/jupyterlite#911.

@asmeurer
Copy link
Member Author

Well there's also the converse issue, where dependencies are not loaded unless they are imported explicitly by the user #18. Do the recent changes affect that?

@jtpio
Copy link
Contributor

jtpio commented Apr 24, 2023

unless they are imported explicitly by the user #18. Do the recent changes affect that?

This is likely still the case with the latest versions. iirc Pyodide detects import statements and loads the appropriate packages accordingly.

Not sure we can have both. As an alternative we could also try using the xeus python kernel to only include a subset of packages and not rely on the default versions provided by Pyodide: https://github.com/jupyterlite/xeus-python-kernel. But with that kernel the packages will be loaded at startup as well and not lazily (at least not for now).

@asmeurer
Copy link
Member Author

But why doesn't it operate on import statements from within sympy? Internally sympy.plot calls import matplotlib to see if it's installed, but that doesn't trigger installation. Only import matplotlib in the jupyterlite REPL itself does.

@jtpio
Copy link
Contributor

jtpio commented Apr 25, 2023

If I remember correctly Pyodide parses the source submitted by a user and looks for import statements. But I don't think it does this for imports within a module.

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

Successfully merging a pull request may close this issue.

2 participants