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

Detect multiple environments #20

Closed
aseyboldt opened this issue May 24, 2024 · 5 comments · Fixed by #42
Closed

Detect multiple environments #20

aseyboldt opened this issue May 24, 2024 · 5 comments · Fixed by #42

Comments

@aseyboldt
Copy link

If a project has multiple environments (for instance one with gpu and one without), it would be nice if this would show a kernel for each of those environments.

@aseyboldt aseyboldt changed the title Detect multiple environments with kernel Detect multiple environments May 24, 2024
@roaldarbol
Copy link

I think my issue falls under this one - at least it's also related to the environments. I've tried making a Jupyter feature, but the kernel doesn't detect my IRKernel:

[project]
name = "testing"
version = "0.1.0"
description = "Add a short description here"
authors = ["Your Name <and@email>"]
channels = ["conda-forge", "https://prefix.dev/r-forge/"]
platforms = ["osx-64"]

[tasks]

[dependencies]
r-base = "4.2"

[feature.jupyter.dependencies]
jupyterlab = "*"
pixi-kernel = "*"
r-irkernel = "*"

[environments]
jupyter = ["jupyter"]

So the r-irkernel is installed within the feature, but it doesn't get detected:
Screenshot 2024-07-09 at 22 55 59

I open Jupyter with pixi run -e jupyter jupyter lab.

@renan-r-santos
Copy link
Owner

I would love to be able to support Pixi features and environments but I couldn't come up with a good design for this yet. The way this library works doesn't allow for dynamically creating kernel specs based on Pixi environments.
Maybe we could somehow use pixi.toml to define which environment to use when launching a kernel, but I don't believe that would provide a good UX.
I'm very much open to discussing ideas and/or PRs.

@renan-r-santos
Copy link
Owner

Quick update: jupyter/enhancement-proposals#87 should enable pixi-kernel to detect and use multiple environments seamlessly. It is marked for Jupyter 4.4, so it might take a while to land.
I'm looking for alternative approaches such as https://github.com/deshaw/ksmm meanwhile. If anyone wants to work on this, let me know.

@2themaxx
Copy link

One thing I've done (just discovered pixi-kernel) is up manually add my pixi environment directory to an existing conda install (envs_dirs in .condarc) and use the environments using nb_conda_kernels side-by-side. I'm not sure how nb_conda_kernels resolves it's environments and kernel spec, but it might make sense follow their example. I add conda and nb_conda_kernels to my base (or also the default) environment and it seems to work pretty well. This is also useful for people who are transitioning away from conda.

@renan-r-santos
Copy link
Owner

I'm not sure how nb_conda_kernels resolves it's environments and kernel spec, but it might make sense follow their example.

nb_conda_kernels collects environments during JupyterLab startup but that wouldn't be a good fit with the dynamic nature of Pixi and per-folder Pixi projects.

I'm finalizing adding support for detecting and using different Pixi environments in #42 and a release should happen in the next couple of days. If anyone has time, it would be great if they could test that branch. Thanks and happy holidays!

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.

4 participants