bug with multiple R versions, missing RTools on Windows
olivroy opened this issue · 3 comments
I have 2 versions of R installed on Windows.
R 4.2.3 + RTools42
R 4.3.0 (No RTools)
When running with R 4.3.0 an installation
pak::pak("r-lib/usethis")
✔ Loading metadata database ... done
→ Will update 1 package.
→ The package (0 B) is cached.
+ usethis 2.1.6 → 2.2.2.9000 [bld][cmp] (GitHub: 467ff57)
! usethis is loaded in the current R session, you probably need to restart R after the installation.
? Do you want to continue (Y/n) y
ℹ No downloads are needed, 1 pkg is cached
✔ Got usethis 2.2.2.9000 (source) (3.05 MB)
ℹ Packaging usethis 2.2.2.9000
✔ Packaged usethis 2.2.2.9000 (19.4s)
ℹ Building usethis 2.2.2.9000
Error:
! error in pak subprocess
Caused by error:
! Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Type .Last.error to see the more details.
> pkgbuild::check_build_tools()
Your system is ready to build packages!
> pkgbuild::check_build_tools(debug = TRUE)
Found in Rtools 4.2 installation folder
Maybe I am mistaken and this is an intended behaviour.
Can you install packages with pak
from GitHub without RTools installed?
Because remotes::install_github("r-lib/usethis")
worked.
Details of the error message
> pak::pak("r-lib/usethis")
✔ Loading metadata database ... done
→ Will update 1 package.
→ The package (0 B) is cached.
+ usethis 2.1.6 → 2.2.2.9000 [bld][cmp] (GitHub: 467ff57)
! usethis is loaded in the current R session, you probably need to restart R
after the installation.
? Do you want to continue (Y/n) y
ℹ No downloads are needed, 1 pkg is cached
✔ Got usethis 2.2.2.9000 (source) (3.05 MB)
ℹ Packaging usethis 2.2.2.9000
✔ Packaged usethis 2.2.2.9000 (19.4s)
ℹ Building usethis 2.2.2.9000
Error:
! error in pak subprocess
Caused by error:
! Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Type .Last.error to see the more details.
> pkgbuild::check_build_tools()
Your system is ready to build packages!
> pkgbuild::check_build_tools(debug = TRUE)
Found in Rtools 4.2 installation folder
Your system is ready to build packages!
> .Last.error
<callr_error/rlib_error_3_0/rlib_error/error>
Error:
! error in pak subprocess
Caused by error:
! Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
---
Backtrace:
1. pak::pak("r-lib/usethis")
2. pak::pkg_install(pkg, ...)
3. pak:::remote(function(...) get("pkg_install_do_plan", asNamespace("pak"))(...…
4. err$throw(res$error)
---
Subprocess backtrace:
1. base::withCallingHandlers(cli_message = function(msg) { …
2. get("pkg_install_do_plan", asNamespace("pak"))(...)
3. proposal$install()
4. pkgdepends::install_package_plan(plan, lib = private$library, num_workers = nw, …
5. base::withCallingHandlers({ …
6. pkgdepends:::start_task(state, task)
7. pkgdepends:::start_task_build(state, task)
8. pkgdepends:::make_build_process(path, pkg, tmp_dir, lib, vignettes, needscompilation…
9. pkgdepends:::withr_with_libpaths(c(tmplib, lib), action = "prefix", pkgbuild_process…
10. base::force(code)
11. pkgbuild_process$new(path, tmp_dir, binary = binary, vignettes = vignet…
12. local initialize(...)
13. pkgbuild:::rcb_init(self, private, super, path, dest_path, binary, vignettes, …
14. pkgbuild:::build_setup(path, dest_path, binary, vignettes, manual, clean_doc, …
15. pkgbuild:::build_setup_binary(path, dest_path, args, needs_compilation)
16. pkgbuild::check_build_tools(quiet = TRUE)
17. base::stop("Could not find tools necessary to compile a package\n", …
18. | base::.handleSimpleError(function (e) …
19. global h(simpleError(msg, call))
Can you install packages with pak from GitHub without RTools installed?
You cannot currently, because pkgbuild checks for RTools, even if the package does not need compilation.
Because
remotes::install_github("r-lib/usethis")
worked.
Because that probably does not use pkgbuild.
Closing as duplicate of #165 thanks!
You cannot currently, because pkgbuild checks for RTools, even if the package does not need compilation.
If it is planned that pak uses pkgbuild
unconditionally for this, it may be worth adding some doc to pak to warn about this, as tidyverse advertises pak
more in README pages.
Fortunately, with pkgbuild 1.4.2 the instructions are more clear :)
Edit: I just saw that you may want to change this in r-lib/pak#225