Open DavisVaughan opened 6 years ago
I think I have further tracked down what is happening. If you look inside the recursive loop that I pointed out as being problematic, there is an allRecords
object that is being looped over. For me, it contains:
The 4th element there is a Github version of ansistrings
. If I just run the lapply
on that record, then we hit the infinite loop. By debugging getPackageDependencies
, it seems to be doing:
key) pkg -> deps
Ansistrings -> c(crayon, glue, rematch2)
Crayon -> NONE
Glue -> NONE
Rematch2 -> tibble
Tibble -> c(cli, crayon, pillar, rlang)
Cli -> c(R6, ansistrings, assertthat, crayon, glue, progress, selectr, withr, xml2)
R6 -> NONE
Ansistrings -> c(crayon, glue, rematch2)
Loop……
Its almost like it doesnt have a memory that it already looked at ansistrings
and it tries to get its package dependencies and records again, causing the loop.
Ah ha! If you look, I was also using the github version for cli
. The CRAN version of cli
does not have the dep on ansistrings
, so I tried installing the CRAN version instead. This removed the recursive loop and everything is working properly again.
ansistrings
is actually not on CRAN yet. I wonder if there is a two way package dependency (i depend on you and you depend on me) in there that would come out in a CRAN check of the package? If I remember right, CRAN doesn't allow such a thing.
cc: @hadley @gaborcsardi
The fact that Packrat doesn't handle this is definitely a bug in Packrat, but we should try to break the dependency chain nonetheless to avoid other potential issues.
Just removed the ansistrings -> tibble dependency, so this should be solved.
Eventually ansistrings will be included in crayon, which will further simplify things.
I have boiled this down into a hopefully reproducible set of steps.
1) Create a new Project in RStudio. 2) Create an R file in that project,
test-pr.R
3) Addlibrary(dplyr)
to thattest-pr.R
file. 4) Save, and runpackrat::init()
5) This takes awhile and crashes with the error:Traceback:
This shows that the recursive loop in
getPackageRecords(inferredPkgsNotInLib, ...)
is causing the problem. Are there just too many dependencies to recurse through? I'd be interested in upping the stack size withulimit
and retrying if you can show me how to do that from within the current R process.As the details below show, I am on a Mac running R 3.4.3 with CRAN dplyr and Github packrat, but CRAN packrat fails as well.
I should also note that I found this problem while trying to push an Rmd that used a package that depended on
dplyr
to RStudio Connect and it failed, so that kind of sucked.