positron icon indicating copy to clipboard operation
positron copied to clipboard

Automatic discovery of Pixi R interpreters

Open roaldarbol opened this issue 1 year ago • 13 comments

On top of python interpreters from conda/mamba and global R installations (e.g. with rig), they can both be installed with pixi to pin versions within a single project - incredibly useful when it comes to reproducibility.

So this feature request is for the automatic discovery of interpreters living inside a .pixi folder inside the opened project/folder. Note, that this has just been implemented for VS Code (for Python only), but does not work in Positron. Maybe it can be patched, or there's possibly help to find in that PR. In any case it would also need to be implemented for R interpreter.

roaldarbol avatar Jun 28 '24 21:06 roaldarbol

That is great to see, never came across pixi but seems like a great way to manage environments. I'd also like to flag micromamba, the most efficient way to set-up and configure Python envs I've come across. No built-in support in VS Code but there's a good extension: https://marketplace.visualstudio.com/items?itemName=corker.vscode-micromamba

Would Pixi supercede the need for micromamba support @roaldarbol? You've saved me opening a feature request if so!

Robinlovelace avatar Jun 29 '24 16:06 Robinlovelace

Also see https://github.com/prefix-dev/pixi/issues/1543 by the author of the original post.

Robinlovelace avatar Jun 29 '24 16:06 Robinlovelace

@Robinlovelace It will! So the guys at prefix are the same folks behind mamba, and pixi is their "new" flagship - mamba will of course still be supported as I understand it. I use pixi now with all my projects, and we're just laying final touches on the last missing features to make it the option for R too - I currently have some nice mixed R/Python projects managed in the same environment, fully reproducible and IDE-independent. 😊

roaldarbol avatar Jun 29 '24 18:06 roaldarbol

Very cool, keep up the great work!

Robinlovelace avatar Jun 30 '24 21:06 Robinlovelace

Thank you for the info! Since we're currently using a fork of the vscode-python extension, the new pixi locator should just work once we've merged the latest release from upstream 🤞

seeM avatar Jul 01 '24 11:07 seeM

@seeM That sounds great! How about discovery of R installation? Since it's also possible to download R from conda-forge, that can also live in .pixi - will that also be discoverable then, or will that require extra modifications on the Positron side?

roaldarbol avatar Jul 01 '24 12:07 roaldarbol

And just to think ahead, once if Julia gets better support (https://github.com/posit-dev/positron/issues/3679) - and since Julia is also on conda-forge - could that become discoverable too. :-)

roaldarbol avatar Jul 01 '24 12:07 roaldarbol

This may not be the best place for this question but the above comms makes me wonder: is there a way to default to a system installation? That could reduce bandwidth and HD resources of installing software multiple times on different environments. Or would you just not use pixi when you want to use system installation?

Robinlovelace avatar Jul 01 '24 12:07 Robinlovelace

There is, you can pixi global install <package>. And good that you mentioned it, just opened https://github.com/posit-dev/positron/issues/3767, requesting Positron on conda-forge to allow a global installation of it. For more pixi-related questions, I recommend checking out their documentation and joining their Discord - super helpful and responsive - it's a great community. :-)

roaldarbol avatar Jul 01 '24 13:07 roaldarbol

@seeM That sounds great! How about discovery of R installation? Since it's also possible to download R from conda-forge, that can also live in .pixi - will that also be discoverable then, or will that require extra modifications on the Positron side?

It would not affect R discovery, since that is a totally separate extension with its own machinery at this point.

seeM avatar Jul 02 '24 10:07 seeM

Which extension is that? And I guess that is then the crux of this issue. :-)

roaldarbol avatar Jul 02 '24 11:07 roaldarbol

Let's use this feature to track interest in supporting Pixi interpreters for R. Thanks! 🙌

juliasilge avatar Jul 02 '24 14:07 juliasilge

@jennybc pointed me to this issue that seems related: https://github.com/posit-dev/positron/issues/2235

joshualeond avatar Jul 05 '24 18:07 joshualeond

The discovery of Python pixi interpreters has just been released in the vscode-python extension.

roaldarbol avatar Jul 09 '24 07:07 roaldarbol

This is great to see! Any chance of Positron using that extension or will it be a case of developing parallel functionality 'in-house', I wonder.

Robinlovelace avatar Jul 09 '24 09:07 Robinlovelace

They already do - so as soon as the new release gets merged here, it should work. https://github.com/posit-dev/positron/issues/3724#issuecomment-2199892118

Thank you for the info! Since we're currently using a fork of the vscode-python extension, the new pixi locator should just work once we've merged the latest release from upstream 🤞

roaldarbol avatar Jul 09 '24 10:07 roaldarbol

@roaldarbol is correct! The latest vscode-python release is a bit more complicated than usual (they've reimplemented environment discovery in Rust, which means we have to get the Rust toolchain + build setup properly too – also means much faster discovery! 🎉), so this update will take us a little longer than usual to merge.

seeM avatar Jul 09 '24 10:07 seeM

@roaldarbol is correct! The latest vscode-python release is a bit more complicated than usual (they've reimplemented environment discovery in Rust, which means we have to get the Rust toolchain + build setup properly too – also means much faster discovery! 🎉), so this update will take us a little longer than usual to merge.

That would be great for Positron because for me its biggest issue at the moment is the abnormal long time (several minutes) it takes to discover interpreters and connect to the selected one...

PS: pixi is really awesome, it is finally solving Python package management nightmare.

GitHunter0 avatar Sep 22 '24 17:09 GitHunter0

@GitHunter0 We expect that long discovery time to only happen the first time you open a folder. Once you choose an interpreter in a workspace, it "remembers" and will immediately start that interpreter when you re-open the workspace in the future. Also, if a certain interpreter has been discovered, you can choose it right away; you don't have to wait for all interpreters to be discovered to start one that you want. We do have further improvements planned for interpreter discovery, but if today any of what I described isn't working for you, we would love a report! 🙌

juliasilge avatar Sep 23 '24 14:09 juliasilge

@roaldarbol is correct! The latest vscode-python release is a bit more complicated than usual (they've reimplemented environment discovery in Rust, which means we have to get the Rust toolchain + build setup properly too – also means much faster discovery! 🎉), so this update will take us a little longer than usual to merge.

Just FYI for Pythonistas: Since this issue no longer tracks the Python installation, I think it went under the radar - but Positron does now discover Pixi Python installations. 🚀

roaldarbol avatar Oct 17 '24 18:10 roaldarbol