Skip to content

Add Conda R interpreter discovery #6888

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

Closed
wants to merge 4 commits into from
Closed

Add Conda R interpreter discovery #6888

wants to merge 4 commits into from

Conversation

kv9898
Copy link
Contributor

@kv9898 kv9898 commented Mar 20, 2025

New Features

image

Bug Fixes

  • N/A

QA Notes

  • Tested it on Windows.
  • Didn't test on Linux/WSL, but my WSL works with my conda R installation once I manually add it to the list - so in theory my PR should work for Linux.
  • I haven't tried with OSX at all I would assume it behaves similar to Linux.
  • Note using the interpreter does not involve activating the Conda environment

@kv9898 kv9898 changed the title Add conda R interpreter discovery for non-Windows platforms Add Conda R interpreter discovery Mar 20, 2025
@wesm
Copy link
Contributor

wesm commented Mar 21, 2025

This discovers my miniforge R installation (I have no global R install) on macOS!

@kv9898
Copy link
Contributor Author

kv9898 commented Mar 22, 2025

This discovers my miniforge R installation (I have no global R install) on macOS!

@wesm Thx for testing! @petetronic I assume I need a code review by a member of the Posit team before my PR can be merged?

@jennybc
Copy link
Member

jennybc commented Mar 24, 2025

Thanks @kv9898 for this PR! We definitely recognize the need to support conda users, who use R with Positron. And R discovery is a key part of that (but by no means all of it).

Better conda support is on our roadmap and our goal is to take a holistic view that also accounts for critical downstream workflows, such as package installation. Many of us have seen a lot of pain over the years caused by unintentional "mixed workflows", where conda use gets combined with binary packages from CRAN, which does not end well. Our hope is to introduce improved conda support that sets R users up for long-term success, especially around package management.

I just wanted to chime in with our appreciation for this PR, even though we are not in a position to move on this in the immediate future.

@kv9898
Copy link
Contributor Author

kv9898 commented Mar 25, 2025

Thanks @kv9898 for this PR! We definitely recognize the need to support conda users, who use R with Positron. And R discovery is a key part of that (but by no means all of it).

Better conda support is on our roadmap and our goal is to take a holistic view that also accounts for critical downstream workflows, such as package installation. Many of us have seen a lot of pain over the years caused by unintentional "mixed workflows", where conda use gets combined with binary packages from CRAN, which does not end well. Our hope is to introduce improved conda support that sets R users up for long-term success, especially around package management.

I just wanted to chime in with our appreciation for this PR, even though we are not in a position to move on this in the immediate future.

Can we add this as an optional/experimental feature that is turned off by default? Because it seems that many paople are manually adding their Conda R paths - at least this PR can save them some hassle.

@juliasilge
Copy link
Contributor

That is a reasonable point, @kv9898! I'll open a new PR with your commits (because of the problem we have with #6628) and have @jennybc review it. We do have better support for conda R interpreters on our roadmap, but we can get this initial detection merged in behind a disabled experimental feature flag.

Like @jennybc, I do want to highlight that much of the substance of the R support in Positron will not work just because we detect the interpreter. We plan to re-examine that when we address #4398 more holistically.

@petetronic
Copy link
Collaborator

petetronic commented Mar 25, 2025

Thank you @kv9898 for your contribution and flexibility!

juliasilge added a commit that referenced this pull request Mar 27, 2025
This is an internal PR based on #6888, to get around the problems
outlined in #6628

### Release Notes

No release notes

### QA Notes

No QA needed; we are not adding _any_ supported functionality for conda
R interpreters at this time.

Let's run the tests:

@:critical @:sessions @:r-pkg-development

---------

Co-authored-by: Dianyi Yang <kv9898@rubuky.com>
@kv9898
Copy link
Contributor Author

kv9898 commented Mar 27, 2025

@jennybc @juliasilge Not sure if this alleviates any of your concerns, but quite a few conda-based R users actually manage their packages directly through R, rather than via conda. The reason is that managing R packages through conda often leads to unexpected issues—perhaps one reason conda is less popular among R users compared to Python users.

I get the impression many of them use conda mainly to segregate environments across multiple projects, or simply to avoid installing R system-wide—especially those coming from a Python background.

Thanks again for the PR review, your thoughtful consideration, and the rewrite! It's been a pleasure contributing to the Positron project!

@jennybc
Copy link
Member

jennybc commented Mar 27, 2025

@kv9898 Are you aware of an existing write-up of "here's how I use conda with R"? I ask because this really catches my ear: "quite a few conda-based R users actually manage their packages directly through R, rather than via conda". I'd love to know exactly what this means. An early part of our real effort to deal with has to be doing research on what safe/correct conda usage with R actually looks like. As package maintainers and instructors, several of us feel like we've tried to help folks who used conda suboptimally, causing a lot of dysfunction and pain in the process. We need to develop precise descriptions of "good" vs. "bad" patterns for using conda with R.

@kv9898
Copy link
Contributor Author

kv9898 commented Mar 27, 2025

@kv9898 Are you aware of an existing write-up of "here's how I use conda with R"? I ask because this really catches my ear: "quite a few conda-based R users actually manage their packages directly through R, rather than via conda". I'd love to know exactly what this means. An early part of our real effort to deal with has to be doing research on what safe/correct conda usage with R actually looks like. As package maintainers and instructors, several of us feel like we've tried to help folks who used conda suboptimally, causing a lot of dysfunction and pain in the process. We need to develop precise descriptions of "good" vs. "bad" patterns for using conda with R.

Sure. Here's the first post that came to my mind: https://www.reddit.com/r/bioinformatics/comments/14nthyb/does_it_have_something_like_conda_but_for_r/, where it says "In my experience, there are... many weird bugs and hitches you run into when trying to install R packages from conda directly that magically disappear when you install from CRAN or bioconductor directly".

I'm sure I have seen other similar posts, I will add to this comment once I find their links:

https://stackoverflow.com/questions/34705917/how-to-install-r-packages-that-are-not-available-in-r-essentials

https://stackoverflow.com/questions/36652015/how-to-install-r-packages-not-in-the-conda-repositories

@kv9898 kv9898 closed this Mar 27, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support R interpreters installed via conda
5 participants