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

Preload custom wheels in pyodide kernel #96

Closed
jvailius opened this issue Mar 7, 2024 · 4 comments
Closed

Preload custom wheels in pyodide kernel #96

jvailius opened this issue Mar 7, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jvailius
Copy link

jvailius commented Mar 7, 2024

Problem

I have a custom local wheel that I can make available by moving it into a top level pypi folder. Then I can successfully run %pip install mypkg. I was wondering if there is a way to pre-load / pre-install custom wheels like it is done with some packages when I open a new notebook. Essentially I'd like to avoid the install step and just do an import mypkg.

Proposed Solution

Not a complete solution but as far as I can see it works this way with the packages included in pyodide. They live in output_dir/static/pyodide folder in my build. Maybe custom packages could be included there as well?

I built jupyterlite with --pyodide https://github.com/pyodide/pyodide/releases/download/0.26.0a3/pyodide-0.26.0a3.tar.bz2

P.S.: Great and very useful project!

@jvailius jvailius added the enhancement New feature or request label Mar 7, 2024
@bollwyvl bollwyvl transferred this issue from jupyterlite/jupyterlite Mar 7, 2024
@bollwyvl
Copy link
Contributor

bollwyvl commented Mar 7, 2024

Closing as a duplicate of #48.

At present, the only semi-automated way to achieve a %pip-less install is to "build" a full custom pyodide distribution before running jupyter lite build:

  • get the full pyodide distribution
  • get/build all the dependencies of your wheel(s) not included in the distribution
    • put your wheel these wheels in the pyodide folder
  • rebuild the pyodide-lock.json file with https://github.com/pyodide/pyodide-lock
  • configure PyodideAdon.pyodide_url to point at the distribution

Some ways forward:

@bollwyvl bollwyvl closed this as completed Mar 7, 2024
@jvailius
Copy link
Author

jvailius commented Mar 7, 2024

@bollwyvl Thanks for the hints - I'll give it a try. I saw/read the other issue and even tried xeus which indeed solved my initial problem but then left me with other issues like requests that did not work.

@martinRenou
Copy link
Member

like requests that did not work

I'm curious about this. requests should work with jupyterlite-xeus and xeus-python. If you have an issue with it please open an issue on https://github.com/jupyterlite/xeus so we can discuss it :)

@jvailius
Copy link
Author

jvailius commented Mar 7, 2024

I'm curious about this. requests should work with jupyterlite-xeus and xeus-python.

I tried fetch from the js module (seems to make some sense in the browser) which gave me some wasm errors. Then I tried other http libs. I'll add an issue over at xeus.

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

No branches or pull requests

3 participants