-
Notifications
You must be signed in to change notification settings - Fork 154
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
Endless attempts to install pak when enabled #1577
Comments
You could try adding some code like the following in your
That should hopefully give you some hints as to where |
The fact that this only happens sometimes is especially surprising. I'm not sure what to make of that. |
Yes, that is exactly the sort of tip I was looking for! Thanks very much. When I've run it, I'll let you know what happened |
@MiguelRodo, do you have any updates? |
Hi @kevinushey, sorry, I've been snowed in at work this week. I'll have a look in the next couple days |
Hi @kevinushey. So, I've been able to have a look again at this, here's what I've found. I tried running the code you suggested setHook("renv::autoload", function(...) {
trace(renv:::renv_pak_init, quote(print(rlang::trace_back())))
}) but in a new container it complained that
A lot of output was printed out, and I'm not too familiar with the if (file.exists("r_output.txt")) {
stop()
}
file.create("r_output.txt")
file_connection <- file("r_output.txt")
sink(file = file_connection)
if (file.exists("r_msg.txt")) {
file.remove("r_msg.txt")
}
file.create("r_msg.txt")
file_connection_msg <- file("r_msg.txt")
sink(file = file_connection_msg)
sink(file = file_connection_msg, type = "message") I put that above the code snippet you suggested in I think the call stack is printed right at the bottom of One thing I did notice was that R is being repeatedly restarted, in between attempts I think to install
You can see the download directory is different between each attempt: ```R
The downloaded source packages are in
‘/tmp/Rtmptm8Ymm/downloaded_packages’
Error in loadNamespace(name) : there is no package called ‘pak’
Calls: source ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
In utils::install.packages("pak", repos = renv_pak_repos(stream)) :
installation of package ‘pak’ had non-zero exit status
Execution halted
The downloaded source packages are in
‘/tmp/RtmpQa8aMx/downloaded_packages’
Error in loadNamespace(name) : there is no package called ‘pak’
Calls: source ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
In utils::install.packages("pak", repos = renv_pak_repos(stream)) :
installation of package ‘pak’ had non-zero exit status
Execution halted
The downloaded source packages are in
‘/tmp/RtmpYQR1VB/downloaded_packages’
Error in loadNamespace(name) : there is no package called ‘pak’
Calls: source ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
In utils::install.packages("pak", repos = renv_pak_repos(stream)) :
installation of package ‘pak’ had non-zero exit status
Execution halted
I'm not sure, but it sounds like what might be happening is R starts, tries to install Note that the snippet I added stopped R restarting (as it used |
TLDR: The issue should only appear when a lockfile exists that specifies the BioConductor version, and pak is enabled but not already installed. I suspect that the Upon further digging:
if (length(lockfile)) {
renv_load_r(project, lockfile$R)
renv_load_python(project, lockfile$Python)
renv_load_bioconductor(project, lockfile$Bioconductor)
} That would make sense of why I couldn't simply reproduce the issue by starting a new repo - there was no lockfile.
if (getRversion() < "3.4")
return()
version <- bioconductor$Version
if (is.null(version))
return()
renv_bioconductor_init() This would also explain the flakiness, assuming the BioConductor version isn't set automatically simply based on the R version (which the presence of the
Obviously,
Error in loadNamespace(name) : there is no package called ‘pak’
Calls: source ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
In addition: Warning message:
In utils::install.packages("pak", repos = renv_pak_repos(stream)) :
installation of package ‘pak’ had non-zero exit status That suggests perhaps that No need for a long reply, particularly if I've missed the plot! I suspect it's most likely the recursion detection not working correctly, fwiw. |
@MiguelRodo, thank you so much for the in-depth investigation -- it's hugely helpful! Here's my understanding + hypothesis:
I have a PR up at #1620 that I think will help. We ensure that the R process launched for installation uses |
Thanks, Kevin! I tested it my side, and it solved the issue - thanks for fixing it so quickly! |
Glad to hear it -- thanks for taking the time to verify! |
When I try to open
R
in a project that has usedrenv
before on a new machine withRENV_CONFIG_PAK_ENABLED=true
,pak
is typically (not always) endlessly downloaded:The above will go on endlessly unless I force stop it.
This persists even though
renv
v1.0.0
and the nightly version ofpak
(well, I think - version0.5.1.9000
) were installed (the output below was generated from openingR
in another non-renv
directory (before attempting to open the directory that usesrenv
, I should add)):I have tried to produce a minimal example (setting up R4.2.3 and R4.3.1 on two different Docker images each), but I couldn't reproduce the error, however. So, could you give me some pointers as to where to look?
The text was updated successfully, but these errors were encountered: