Closed latot closed 7 months ago
You cannot have circular dependencies in R packages, there is no way to install them. There is also no way to load these packages, if you were to managed to install them using some hack.
This is not a limitation of pak, it is the limitation of the packaging system.
If you have this case, and the code is pure R, you can choose any package to install ignoring the other dependence, I have installed packages like this with devtools::install("something", dependencies = FALSE)
.
I would like a more robust solution for complex projects, but is not easy without break the organization and abstracts.
No, that does not work. More precisely, it only works if the dependencies are already installed, or if you are installing a binary package, which is just an untar/unzip.
You cannot install a source package without its dependencies, even if you specify dependencies = FALSE
:
❯ usethis::create_package("foobar123")
✔ Creating 'foobar123/'
✔ Setting active project to '/private/tmp/foobar123'
✔ Creating 'R/'
✔ Writing 'DESCRIPTION'
[...]
✔ Writing 'NAMESPACE'
❯ desc::desc_set_dep("foobar124")
[...]
❯ desc::desc_get_deps()
type package version
1 Imports foobar124 *
❯ install.packages(".", repos = NULL, type = "source", dependencies = FALSE)
Installing package into ‘/Users/gaborcsardi/Library/R/arm64/4.3/library’
(as ‘lib’ is unspecified)
ERROR: dependency ‘foobar124’ is not available for package ‘foobar123’
* removing ‘/Users/gaborcsardi/Library/R/arm64/4.3/library/foobar123’
Warning message:
In install.packages(".", repos = NULL, type = "source", dependencies = FALSE) :
installation of package ‘.’ had non-zero exit status
yes, we can force the dep to be installed, then install the other one.... how complex organize in R, originally the lib I wrote... both belongs to the same one, but how I can organize the functions I needed to split it in two, but them the common functions causes this..!! and there is even more libs!
yes, we can force the dep to be installed, then install the other one...
You cannot do that if they both depend on the other.
Since we cannot do much about this, I am going to close this issue.
Hi, I was trying to install packages with
pak::pkg_install
, then I notice some packages failed to install.This happens when we have two packages, A and B, and A depends on B, and B depends on A.
I think we all know R is not the best way to organize, conceptualize code, so there is some cases with some systems we can get things like that.
There is the argument "Split and create a new library", but there is several problems on that.
The actual error is:
Well, even with this there is still some concern about it, no idea if some packages with mutual dependence need to one be installed first, but while this is only on R code there should be no problem.
Thx!