Open sharon-wang opened 4 months ago
I don't think that the R 4.3 version above was installed with rig, because I see that it is not orthogonal.
2024-04-30 13:36:18.279 [info] R installation discovered: {
"valid": true,
"supported": false,
"binpath": "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R",
"homepath": "/Library/Frameworks/R.framework/Resources",
"semVersion": {
"options": {},
"loose": false,
"includePrerelease": false,
"raw": "4.1.3",
"major": 4,
"minor": 1,
"patch": 3,
"prerelease": [],
"build": [],
"version": "4.1.3".
},
"version": "4.1.3",
"arch": "arm64",
"current": false,
"orthogonal": false <----- 🤨
}
A non-orthogonal R installation is only a well-formed and usable R version when it is set as the current R version. A non-orthogonal R version's binary ("binary", actually, it's just a shell script) actually launches the current version of R. Therefore, the positron-r extension filters out any R versions that are non-orthogonal and non-current. I think we are behaving as intended, given your R installations.
To get to a happier place, rig can make your current installations orthogonal (*) or you could just re-install R 4.3 with rig.
(*) I've never done it myself but I think it's rig system make-orthogonal
.
Ah, yes rig system make-orthogonal
resolved the issue for me and now all the expected > 4.2 versions are detected in Positron 🙌 I don't recall how I installed the 4.3 version, but it does seem like it was not via rig
!
Okay, so "orthogonal" in this context will be true
if the version of R was installed via rig
and false
if it wasn't? And because the R 4.3 I was using was non-orthogonal, the associated semVersion
and other metadata referred to the "Current" version of R, which was R 4.1. Parrot-ing back to check my understanding :)
I only started using rig
recently, so this caveat wasn't apparent to me, but maybe this would be expected by the typical rig
user. I wonder if it's worth noting to the user for "orthogonal": false
versions why they were filtered out, instead of showing that the version is < 4.2.0. Possibly even noting to try rig system make-orthogonal
?
I don't recall how I installed the 4.3 version, but it does seem like it was not via rig!
Probably by installing R from CRAN, which is certainly the path of least resistance / what most folks do.
Okay, so "orthogonal" in this context will be true if the version of R was installed via
rig
and false if it wasn't? And because the R 4.3 I was using was non-orthogonal, the associatedsemVersion
and other metadata referred to the "Current" version of R, which was R 4.1. Parrot-ing back to check my understanding :)
Yeah, this is all correct.
I wonder if it's worth noting to the user for "orthogonal": false versions why they were filtered out, instead of showing that the version is < 4.2.0. Possibly even noting to try
rig system make-orthogonal
?
This is where we log this but now I see this somehow uses console.log()
and it should use LOGGER.info()
:
so that's a good PR to make.
As for doing something about this pathological situation, that remains a TODO:
The use of rig
is still pretty niche. The vast majority of R users have exactly 1 R installation. But I think more people will try having multiple R versions now that rig
+ Positron are going to make it much easier and more fruitful. So we might want to help identify and repair these situations in the future.
So do I understand correctly that we have two items to do now?
@juliasilge Yes that sounds good to me!
I've created a separate issue (https://github.com/posit-dev/positron/issues/2960) to capture the logging fix (https://github.com/posit-dev/positron/pull/2961) and changed this issue to be an enhancement around providing advice for fixing up R installations (to be addressed later).
Background
Increasingly, users may opt to use
rig
to manage multiple installations of R. When users have a combination of R installations installed viarig
and other means (e.g. from CRAN), their non-orthogonal versions of R (i.e. versions of R not installed viarig
) may be filtered out. It can be unclear to a user why an installation of R is not being picked up by Positron and also how to have those versions be included.Thoughts around solution
One solution/workaround is for the user to run
rig system make-orthogonal
or reinstall the version of R they'd like to use viarig
.Other solutions could include handling the non-orthogonal installs differently, so that they are not filtered out, but that may include working around the intended functionality of
rig
.In any case, we may want to add some additional advice in logging or other documentation to help the user understand.
Note from Jenny's comment below:
https://github.com/posit-dev/positron/blob/2d5b6ee8b11890d5176f25c37588f76354db3992/extensions/positron-r/src/provider.ts#L63-L67
Positron Version: 2024.04.0-1576
Steps to reproduce the issue:
I'm working on Mac, but this issue may also occur on other platforms? The relevant code has some Mac-specific caveats, so this could also be Mac-specific.
rig
https://github.com/r-lib/rig?tab=readme-ov-file#%EF%B8%8F-installing-rig-rig
, install a version of R that is > 4.2 and a version that is < 4.2 https://github.com/r-lib/rig?tab=readme-ov-file#%EF%B8%8F-usage-rig default <version>
https://github.com/posit-dev/positron/assets/25834218/daea4b32-0c27-4c8a-9008-6273d910eb30
What did you expect to happen?
Even though R 4.3 is not my default version, since it is still detected in R version discovery, it should be considered as a valid R version.
Were there any error messages in the output or Developer Tools console?
There were no errors in the Developer Tools console, but the following output was found via
Output > Positron R Extension
👇When the R 4.1 is set as my rig default, the Positron R Extension reads in the 4.3 metadata in an odd way (it partially reads in the 4.1 metadata as if it is 4.3 metadata)
4.3 is obviously > than 4.2.0, but the metadata for 4.3 is showing 4.1.3. Something seems to be going wrong with the
semVersion
andversion
properties.When I set 4.3 as my rig default version, the metadata for both 4.3 and 4.1 is as expected, and 4.3 is discovered as a valid interpreter in Positron.
Other Notes
This seems like the most relevant code: https://github.com/posit-dev/positron/blob/main/extensions/positron-r/src/r-installation.ts