r-lib / remotes

Install R packages from GitHub, GitLab, Bitbucket, git, svn repositories, URLs
https://remotes.r-lib.org/
Other
323 stars 152 forks source link

Install_local cp error on windows 10 #800

Open alberto-agudo-dominguez opened 3 days ago

alberto-agudo-dominguez commented 3 days ago

Reopening this thread #456 as it was closed in 2020 but there's recent activity of people with the same issue.

remotes::install_local(
  path = "package_name.zip",
  lib = .Library,
  upgrade = FALSE,
  dependencies = TRUE
)

# Showing that RcppEigen is left as a dependency and installs properly 

#> 
#> Installing 1 packages: RcppEigen
#> trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/RcppEigen_0.3.4.0.0.zip'
#> Content type 'application/zip' length 2591106 bytes (2.5 MB)
#> downloaded 2.5 MB
#> 
#> package 'RcppEigen' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>         C:\Users\first_name.last_name\AppData\Local\Temp\RtmpyONpgJ\downloaded_packages
#> * installing *binary* package 'package_name' ...
#> cp: unknown option -- )
#> Try '/usr/bin/cp --help' for more information.
#> ERROR: installing binary package failed
#> * removing 'C:/Program Files/R/R-4.4.1/library/package_name'
#> * restoring previous 'C:/Program Files/R/R-4.4.1/library/package_name'
#> Warning message:
#> In i.p(...) :
#>   installation of package 'C:/Users/first_name.last_name/AppData/Local/Temp/RtmpyONpgJ/remotes106c405f5500/package_name' had non-zero exit status
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.1 (2024-06-14 ucrt)
#>  os       Windows 10 x64 (build 19045)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  English_United Kingdom.utf8
#>  ctype    English_United Kingdom.utf8
#>  tz       Europe/Madrid
#>  date     2024-07-05
#>  pandoc   3.1.8 @ C:/Users/first_name.last_name/AppData/Local/Pandoc/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cachem        1.1.0   2024-05-16 [1] CRAN (R 4.4.1)
#>  cli           3.6.3   2024-06-21 [1] CRAN (R 4.4.1)
#>  devtools      2.4.5   2022-10-11 [1] CRAN (R 4.4.1)
#>  digest        0.6.36  2024-06-23 [1] CRAN (R 4.4.1)
#>  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.4.1)
#>  evaluate      0.24.0  2024-06-10 [1] CRAN (R 4.4.1)
#>  fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.4.1)
#>  fs            1.6.4   2024-04-25 [1] CRAN (R 4.4.1)
#>  glue          1.7.0   2024-01-09 [1] CRAN (R 4.4.1)
#>  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.4.1)
#>  htmlwidgets   1.6.4   2023-12-06 [1] CRAN (R 4.4.1)
#>  httpuv        1.6.15  2024-03-26 [1] CRAN (R 4.4.1)
#>  knitr         1.47    2024-05-29 [1] CRAN (R 4.4.1)
#>  later         1.3.2   2023-12-06 [1] CRAN (R 4.4.1)
#>  lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.4.1)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.4.1)
#>  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.4.1)
#>  mime          0.12    2021-09-28 [1] CRAN (R 4.4.0)
#>  miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.4.1)
#>  pkgbuild      1.4.4   2024-03-17 [1] CRAN (R 4.4.1)
#>  pkgload       1.3.4   2024-01-16 [1] CRAN (R 4.4.1)
#>  profvis       0.3.8   2023-05-02 [1] CRAN (R 4.4.1)
#>  promises      1.3.0   2024-04-05 [1] CRAN (R 4.4.1)
#>  purrr         1.0.2   2023-08-10 [1] CRAN (R 4.4.1)
#>  R.cache       0.16.0  2022-07-21 [1] CRAN (R 4.4.1)
#>  R.methodsS3   1.8.2   2022-06-13 [1] CRAN (R 4.4.0)
#>  R.oo          1.26.0  2024-01-24 [1] CRAN (R 4.4.0)
#>  R.utils       2.12.3  2023-11-18 [1] CRAN (R 4.4.1)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.4.1)
#>  Rcpp          1.0.12  2024-01-09 [1] CRAN (R 4.4.1)
#>  remotes       2.5.0   2024-03-17 [1] CRAN (R 4.4.1)
#>  reprex        2.1.0   2024-01-11 [1] CRAN (R 4.4.1)
#>  rlang         1.1.4   2024-06-04 [1] CRAN (R 4.4.1)
#>  rmarkdown     2.27    2024-05-17 [1] CRAN (R 4.4.1)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.4.1)
#>  shiny         1.8.1.1 2024-04-02 [1] CRAN (R 4.4.1)
#>  stringi       1.8.4   2024-05-06 [1] CRAN (R 4.4.0)
#>  stringr       1.5.1   2023-11-14 [1] CRAN (R 4.4.1)
#>  styler        1.10.3  2024-04-07 [1] CRAN (R 4.4.1)
#>  urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.4.1)
#>  usethis       2.2.3   2024-02-19 [1] CRAN (R 4.4.1)
#>  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.4.1)
#>  withr         3.0.0   2024-01-16 [1] CRAN (R 4.4.1)
#>  xfun          0.45    2024-06-16 [1] CRAN (R 4.4.1)
#>  xtable        1.8-4   2019-04-21 [1] CRAN (R 4.4.1)
#>  yaml          2.3.8   2023-12-11 [1] CRAN (R 4.4.0)
#> 
#>  [1] C:/Program Files/R/R-4.4.1/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Created on 2024-07-05 with reprex v2.1.0

gaborcsardi commented 3 days ago

Can you install other packages? This is possibly specific to your package, in which case we cannot reproduce this. Do you have Rtools installed? Is it on the path? Can you install the package with R CMD INSTALL?

alberto-agudo-dominguez commented 16 hours ago

Hi Gabor,

I cannot install other binary packages with remotes::install_local, although I am able to with install.packages. remotes::install_local does work for me with source packages. As a side note, devtools::install_local gives the same problems.

Yes, I have an Rtools compiler and I am able to compile source code, although many of the end users of my product won't, so that's why I am building some packages that require compilation as binaries.

Please see the examples below (install_local with source, install_local with binary, and install.packages with binary):

dir <- tempfile()
dir.create(dir)

# --- Install local working on source
pkg <- download.packages("testthat", dir, type = "source")
#> trying URL 'https://cloud.r-project.org/src/contrib/testthat_3.2.1.1.tar.gz'
#> Content type 'application/x-gzip' length 739761 bytes (722 KB)
#> downloaded 722 KB

remotes::install_local(pkg[, 2], 
                      lib = .Library,
                      upgrade = FALSE,
                      dependencies = TRUE
                      )
#> Installing 1 packages: diffviewer
#> trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/diffviewer_0.1.2.zip'
#> Content type 'application/zip' length 187352 bytes (182 KB)
#> downloaded 182 KB
#> 
#> package 'diffviewer' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>         C:\Users\alberto.agudo\AppData\Local\Temp\RtmpeACHqn\downloaded_packages
#> ── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────✔  checking for file 'C:\Users\alberto.agudo\AppData\Local\Temp\RtmpeACHqn\remotes579845ba7c5\testthat/DESCRIPTION' (855ms)
#> ─  preparing 'testthat': (8.7s)
#> ✔  checking DESCRIPTION meta-information ... 
#> ─  cleaning src
#> ✔  checking vignette meta-information (876ms)
#> ─  checking for LF line-endings in source and make files and shell scripts (1.8s)
#> ─  checking for empty or unneeded directories
#> ─  building 'testthat_3.2.1.1.tar.gz'
#>    
#> * installing *source* package 'testthat' ...
#> ** using staged installation
#> ** libs
#> using C compiler: 'gcc.exe (GCC) 13.2.0'
#> using C++ compiler: 'G__~1.EXE (GCC) 13.2.0'
#> gcc  -I"C:/PROGRA~1/R/R-44~1.1/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT    -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c init.c -o init.o
#> gcc  -I"C:/PROGRA~1/R/R-44~1.1/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT    -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c reassign.c -o reassign.o
#> g++ -std=gnu++17  -I"C:/PROGRA~1/R/R-44~1.1/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT    -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c test-catch.cpp -o test-catch.o
#> g++ -std=gnu++17  -I"C:/PROGRA~1/R/R-44~1.1/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT    -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c test-example.cpp -o test-example.o
#> g++ -std=gnu++17  -I"C:/PROGRA~1/R/R-44~1.1/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT    -I"C:/rtools44/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c test-runner.cpp -o test-runner.o
#> g++ -std=gnu++17 -shared -s -static-libgcc -o testthat.dll tmp.def init.o reassign.o test-catch.o test-example.o test-runner.o -LC:/rtools44/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools44/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~1/R/R-44~1.1/bin/x64 -lR
#> installing to C:/Program Files/R/R-4.4.1/library/00LOCK-testthat/00new/testthat/libs/x64
#> ** R
#> ** inst
#> ** byte-compile and prepare package for lazy loading
#> ** help
#> *** installing help indices
#> *** copying figures
#> ** building package indices
#> ** installing vignettes
#> ** testing if installed package can be loaded from temporary location
#> ** testing if installed package can be loaded from final location
#> ** testing if installed package keeps a record of temporary installation path
#> * DONE (testthat)

# --- Install local not working on binary

binary_pkg <- download.packages("testthat", dir, type = "binary")
#> trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/testthat_3.2.1.1.zip'
#> Content type 'application/zip' length 2244943 bytes (2.1 MB)
#> downloaded 2.1 MB

remotes::install_local(binary_pkg[, 2], 
                      lib = .Library,
                      upgrade = FALSE,
                      dependencies = TRUE
                      )

#> * installing *binary* package 'testthat' ...
#> cp: unknown option -- )
#> Try '/usr/bin/cp --help' for more information.
#> ERROR: installing binary package failed
#> * removing 'C:/Program Files/R/R-4.4.1/library/testthat'
#> * restoring previous 'C:/Program Files/R/R-4.4.1/library/testthat'
#> Warning message:
#> In i.p(...) :
#>   installation of package 'C:/Users/ALBERT~1.AGU/AppData/Local/Temp/RtmpeACHqn/remotes57982c121e30/testthat' had non-zero exit status

# --- Standard install.packages call for binary without compilation works
> install.packages("testthat")

#> trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.4/testthat_3.2.1.1.zip'
#> Content type 'application/zip' length 2244943 bytes (2.1 MB)
#> downloaded 2.1 MB
#> 
#> package 'testthat' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>         C:\Users\alberto.agudo\AppData\Local\Temp\RtmpeACHqn\downloaded_packages

> devtools::session_info()
#> ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.1 (2024-06-14 ucrt)
#>  os       Windows 10 x64 (build 19045)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  English_United Kingdom.utf8
#>  ctype    English_United Kingdom.utf8
#>  tz       Europe/Madrid
#>  date     2024-07-08
#>  pandoc   3.1.8 @ C:\\Users\\ALBERT~1.AGU\\AppData\\Local\\Pandoc\\pandoc.exe
#> 
#> ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cachem        1.1.0   2024-05-16 [1] CRAN (R 4.4.1)
#>  callr         3.7.6   2024-03-25 [1] CRAN (R 4.4.1)
#>  cli           3.6.3   2024-06-21 [1] CRAN (R 4.4.1)
#>  curl          5.2.1   2024-03-01 [1] CRAN (R 4.4.1)
#>  desc          1.4.3   2023-12-10 [1] CRAN (R 4.4.1)
#>  devtools      2.4.5   2022-10-11 [1] CRAN (R 4.4.1)
#>  digest        0.6.36  2024-06-23 [1] CRAN (R 4.4.1)
#>  ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.4.1)
#>  fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.4.1)
#>  fs            1.6.4   2024-04-25 [1] CRAN (R 4.4.1)
#>  glue          1.7.0   2024-01-09 [1] CRAN (R 4.4.1)
#>  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.4.1)
#>  htmlwidgets   1.6.4   2023-12-06 [1] CRAN (R 4.4.1)
#>  httpuv        1.6.15  2024-03-26 [1] CRAN (R 4.4.1)
#>  jsonlite      1.8.8   2023-12-04 [1] CRAN (R 4.4.1)
#>  later         1.3.2   2023-12-06 [1] CRAN (R 4.4.1)
#>  lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.4.1)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.4.1)
#>  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.4.1)
#>  mime          0.12    2021-09-28 [1] CRAN (R 4.4.0)
#>  miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.4.1)
#>  pkgbuild      1.4.4   2024-03-17 [1] CRAN (R 4.4.1)
#>  pkgload       1.3.4   2024-01-16 [1] CRAN (R 4.4.1)
#>  processx      3.8.4   2024-03-16 [1] CRAN (R 4.4.1)
#>  profvis       0.3.8   2023-05-02 [1] CRAN (R 4.4.1)
#>  promises      1.3.0   2024-04-05 [1] CRAN (R 4.4.1)
#>  ps            1.7.6   2024-01-18 [1] CRAN (R 4.4.1)
#>  purrr         1.0.2   2023-08-10 [1] CRAN (R 4.4.1)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.4.1)
#>  Rcpp          1.0.12  2024-01-09 [1] CRAN (R 4.4.1)
#>  remotes       2.5.0   2024-03-17 [1] CRAN (R 4.4.1)
#>  rlang         1.1.4   2024-06-04 [1] CRAN (R 4.4.1)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.4.1)
#>  shiny         1.8.1.1 2024-04-02 [1] CRAN (R 4.4.1)
#>  stringi       1.8.4   2024-05-06 [1] CRAN (R 4.4.0)
#>  stringr       1.5.1   2023-11-14 [1] CRAN (R 4.4.1)
#>  urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.4.1)
#>  usethis       2.2.3   2024-02-19 [1] CRAN (R 4.4.1)
#>  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.4.1)
#>  xtable        1.8-4   2019-04-21 [1] CRAN (R 4.4.1)
#> 
#>  [1] C:/Program Files/R/R-4.4.1/library
#> 
#> ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────