You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
R: update behavior for 'r.packageBuild' command #1091
I might be doing something wrong here, but I'm trying this out in Positron 2023.09.0+83 with the workspace open to the reticulate package, and R 4.3.1 arm64. I do Cmd+Shift+B, and it starts devtools::install() as expected, but then I get an error and it doesn't proceed to restart + library [EDIT: actually apparently it DOES proceed to library + restart, but only after a long delay of at least several minutes during which it looks like it isn't doing anything, and the library call fails anyway since it didn't actually install successfully]
** byte-compile and prepare package for lazy loading
Error in eval(exprs[i], envir) : object 'x' not found
Error: unable to load R code in package ‘reticulate’
Execution halted
ERROR: lazy loading failed for package ‘reticulate’
* removing ‘/Users/jacquelinegutman/Library/R/arm64/4.3/library/reticulate’
Yeah, I tried with rsconnect, where the install succeeds, but it's also a confusingly long delay before restarting
I'm not sure if it's waiting for something? I have a console prompt, and I can code and do whatever, but there's no restart (at least not for a long while)
For context here, when we do devtools::install(), there is no way to directly tell when it has finished. What I did in #1099 has a not-so-great heuristic looking for the package to be updated in the runtime path library, but R users can set their .libPaths() to be whatever they want and I am guessing that is what is happening here.
I haven't done a lot of work developing reticulate but it doesn't shock me that devtools::install() fails for it.
Ideally, if devtools::install fails, we should probably cancel the restart and library call as they don't really make sense if the install failed -- I think it's okay to file that as an issue for future improvement and leave the expected behavior here same for failure or success.
I actually have no idea how I ended up with a libPaths that doesn't point to the same directory as my actual R installation, but 🤷♀️
This is the Rig approved™️ user library that it sets up for you.
Rig is very adamant that you should not be using your R system package library ([2] from above) as the same location as your general R package library ([1] from above for me).
AFAICT, Mac and maybe Linux are the only platforms where it is even possible to have 1 folder that holds both CRAN packages and R system packages like base. On Windows I think you get a user library in a different location by default.
Ah, yeah I did use Rig and in that case every user using rig or using Windows is going to run into this behavior, so that seems like a very common scenario especially for package developers (but at least we don't need to worry about the Windows situation quite yet)
So .ps.install() would show up in the Console, at least for now, but that is ok if we eventually want a build pane.
And then on the Positron side you'd be waiting for "done" to appear in some specific file you know about, rather than trying to track down a DESCRIPTION file (likely with some timeout in case the user cancels the operation or the install fails)
For Davis's suggestion above, I think we'd want to modify that a bit for something that could differentiate between devtools::install failed versus devtools::install is still working
@jgutman and @DavisVaughan would either/both of you be willing to install from main and try again? The new approach here does not assume wrong things about .libPaths() and instead works directly with the runtime in the R extension.
@juliasilge and I have determined that this is currently working, but if you are requested by install() to update packages then it will no longer work (as mentioned in #1279 (comment)). That does happen somewhat often, but we can document in the private alpha docs how to work around this for now (manually install those packages before hitting the keybinding), and #1279 can be the tracking issue for fixing this now.
It is likely we will need to implement a different approach to fix #1279, because we are currently looking for an idle state, but that's exactly what the installation menu prematurely sends the runtime into
Activity
jgutman commentedon Sep 11, 2023
I might be doing something wrong here, but I'm trying this out in Positron 2023.09.0+83 with the workspace open to the reticulate package, and R 4.3.1 arm64. I do Cmd+Shift+B, and it starts
devtools::install()as expected, but then I get an error and it doesn't proceed to restart + library [EDIT: actually apparently it DOES proceed to library + restart, but only after a long delay of at least several minutes during which it looks like it isn't doing anything, and the library call fails anyway since it didn't actually install successfully]juliasilge commentedon Sep 11, 2023
That is the currently expected behavior if
devtools::install()fails, yes. The timeout may be too long:positron/extensions/positron-r/src/commands.ts
Line 166 in 39ab7b1
I haven't done a lot of work developing reticulate but it doesn't shock me that
devtools::install()fails for it.jgutman commentedon Sep 11, 2023
Yeah, I tried with rsconnect, where the install succeeds, but it's also a confusingly long delay before restarting
I'm not sure if it's waiting for something? I have a console prompt, and I can code and do whatever, but there's no restart (at least not for a long while)
DavisVaughan commentedon Sep 11, 2023
I also do not see a restart or a
library()calljuliasilge commentedon Sep 11, 2023
@DavisVaughan what is your
.libPaths()?For context here, when we do
devtools::install(), there is no way to directly tell when it has finished. What I did in #1099 has a not-so-great heuristic looking for the package to be updated in the runtime path library, but R users can set their.libPaths()to be whatever they want and I am guessing that is what is happening here.juliasilge commentedon Sep 11, 2023
When we register a runtime, is it possible to store
.libPaths()in the runtime metadata?jgutman commentedon Sep 11, 2023
Ideally, if devtools::install fails, we should probably cancel the restart and library call as they don't really make sense if the install failed -- I think it's okay to file that as an issue for future improvement and leave the expected behavior here same for failure or success.
I actually have no idea how I ended up with a libPaths that doesn't point to the same directory as my actual R installation, but 🤷♀️
DavisVaughan commentedon Sep 11, 2023
This is the Rig approved™️ user library that it sets up for you.
Rig is very adamant that you should not be using your R system package library (
[2]from above) as the same location as your general R package library ([1]from above for me).AFAICT, Mac and maybe Linux are the only platforms where it is even possible to have 1 folder that holds both CRAN packages and R system packages like
base. On Windows I think you get a user library in a different location by default.So I think this comment was correct about needing something more robust for finding the DESCRIPTION file
https://github.com/posit-dev/positron/pull/1099/files#r1319086271
jgutman commentedon Sep 11, 2023
Ah, yeah I did use Rig and in that case every user using rig or using Windows is going to run into this behavior, so that seems like a very common scenario especially for package developers (but at least we don't need to worry about the Windows situation quite yet)
DavisVaughan commentedon Sep 11, 2023
Another just-to-get-by option for Alpha is to bind the shortcut to a custom function like
.ps.install()which does something likeSo
.ps.install()would show up in the Console, at least for now, but that is ok if we eventually want a build pane.And then on the Positron side you'd be waiting for
"done"to appear in some specific file you know about, rather than trying to track down a DESCRIPTION file (likely with some timeout in case the user cancels the operation or the install fails)jgutman commentedon Sep 11, 2023
For Davis's suggestion above, I think we'd want to modify that a bit for something that could differentiate between devtools::install failed versus devtools::install is still working
juliasilge commentedon Sep 12, 2023
@jgutman and @DavisVaughan would either/both of you be willing to install from main and try again? The new approach here does not assume wrong things about
.libPaths()and instead works directly with the runtime in the R extension.DavisVaughan commentedon Sep 13, 2023
@juliasilge and I have determined that this is currently working, but if you are requested by
install()to update packages then it will no longer work (as mentioned in #1279 (comment)). That does happen somewhat often, but we can document in the private alpha docs how to work around this for now (manually install those packages before hitting the keybinding), and #1279 can be the tracking issue for fixing this now.It is likely we will need to implement a different approach to fix #1279, because we are currently looking for an
idlestate, but that's exactly what the installation menu prematurely sends the runtime into