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

Avoid pip install in every notebook in one project? #48

Open
kolibril13 opened this issue Jun 1, 2023 · 12 comments
Open

Avoid pip install in every notebook in one project? #48

kolibril13 opened this issue Jun 1, 2023 · 12 comments
Labels
enhancement New feature or request

Comments

@kolibril13
Copy link

In order to run a notebook from the ipyreact JupyterLite demo at https://widgetti.github.io/ipyreact,
it requires the line %pip install -q ipyreact.
This is currently needed in every notebook, and I think it would be great if this line would only be needed in one notebook, or even not at all.
Therefore, my question: Is there yet a way to avoid having this line in every notebook using the pyodide kernel?

@kolibril13 kolibril13 added the enhancement New feature or request label Jun 1, 2023
@martinRenou martinRenou transferred this issue from jupyterlite/jupyterlite Jun 1, 2023
@jtpio
Copy link
Member

jtpio commented Jun 1, 2023

Maybe the simplest way for now would be to use the xeus python kernel? https://github.com/jupyterlite/xeus-python-kernel

Defining dependencies in the xeus python kernel is more natural and familiar (via an environment.yml) than with the pyodide kernel at the moment. Also it should work fine for widgets.

@bollwyvl
Copy link
Contributor

bollwyvl commented Jun 1, 2023

Or we again consider #27, so that a deployer can choose which packages can be auto-installed on import on this kernel.

@kolibril13
Copy link
Author

I've tried to use the xeus kernel for ipyreact, but that throws an CI error:
https://github.com/kolibril13/ipyreact-testing-xeus/actions/runs/5145098489/jobs/9262258540

error    libmamba Could not solve for environment specs
    The following package could not be installed
    └─ ipyreact   does not exist (perhaps a typo or a missing channel).

@martinRenou
Copy link
Member

It looks like ipyreact is not available on conda-forge, could be good to have it though ! @maartenbreddels friendly ping :D

@jtpio
Copy link
Member

jtpio commented Jun 1, 2023

Ah looks like it's not packaged for conda. We should open a PR on https://github.com/conda-forge/staged-recipes to add it.

@maartenbreddels
Copy link

I suffer from conda-forge packaging fatigue :)

@maartenbreddels
Copy link

What is the reason conda-forge packages work, but pip packages don't?

@jtpio
Copy link
Member

jtpio commented Jun 2, 2023

What is the reason conda-forge packages work, but pip packages don't?

They will eventually be supported: jupyterlite/xeus-python-kernel#102

@martinRenou
Copy link
Member

I suffer from conda-forge packaging fatigue :)

😅 if it's not a pure Python package, can you please make a PR to emscripten-forge as well? (kidding).

conda-forge/staged-recipes#22993 🚀

@jtpio
Copy link
Member

jtpio commented Jun 2, 2023

I suffer from conda-forge packaging fatigue :)

Well often you can generate most of the recipe with grayskull: https://github.com/conda/grayskull

@maartenbreddels
Copy link

Yes, but it still involves manual steps, especially when requirements/pinning changes. I've streamlined so much of the release process in all my projects, but also supporting conda-forge just sucks the energy out of me for letting me do things manually that feel unnecessary. I like conda/mamba and conda-forge a lot, but the duplicate work that is not automated (but could) just feels very unproductive.

@bollwyvl
Copy link
Contributor

bollwyvl commented Jun 2, 2023

Veering more wildly off-topic, conda-forge.yml has grown some fairly decent python migration powers, but doesn't support all the bells and whistles of the myriad backends. For fairly straightforward build backends (setuptools, flit), the following can be effective:

# /conda-forge.yml
bot:
 automerge: true
 inspection: update-all  # update recipe using all methods

poetry plus a bunch of plugins that mutate the build outside of PEP 517? good luck. hatch plus four dependencies declared somewhere randomly outside of build-system#requires? yeah, naw.

The grayksull+ stuff will not work with the more recent "give me a version now" supported by the conda-forge-admin please update version bot PR command, but with good tests and checks, simple updates can be simple and fast.

But back to this issue about this kernel: some compelling reasons to continue to support this kernel, and adding more package management features that work seamlessly with the upstream pyodide package management system (a la #27), even after another python-based kernel grows micropip support and/or support of binary pyodide packages:

  • pyodide is more widely used outside of jupyterlite
    • benefiting from a larger contributor base of folk from more than one organization
  • being able to use in-development packages to get per-PR builds
    • without installing or invoking any conda-related shenanigans

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

5 participants