r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.4k stars 759 forks source link

devtools::install_github error while testing - related to whitespace on windows #1810

Closed martin-smira closed 6 years ago

martin-smira commented 6 years ago

Hi, after installing the new R 5.1 (may not be related) I run into issues with installing packages - both via base::install.packages() and devtools::install_github(). It seems that the installation of the package goes well, but in the ** testing if installed package can be loaded it returns Fatal error: cannot open file 'C:\Users\Martin': No such file or directory. It's trying to access a directory including a whitespace.

In base::install.packages(), I managed to get around it by passing INSTALL_opts = "--no-test-load" argument, which supresses the testing phase, however the same didn't work on devtools::install_github().

Notes: Windows 10 64bit; R 5.1

Full output:

> devtools::install_github('facebook/prophet', subdir='R', INSTALL_opts = "--no-test-load")
Downloading GitHub repo facebook/prophet@master
from URL https://api.github.com/repos/facebook/prophet/zipball/master
Installing prophet
"C:/PROGRA~1/R/R-3.5.1/bin/x64/R" --no-site-file --no-environ  \
  --no-save --no-restore --quiet CMD INSTALL "C:/Users/Martin  \
  Smira/AppData/Local/Temp/RtmpsderAl/devtools6942f6717c1/facebook-prophet-8d804fc/R"  \
  --library="C:/r_libs" --install-tests 

* installing *source* package 'prophet' ...
** libs
installing via 'install.libs.R' to C:/r_libs/prophet
Compiling model (this will take a minute...)
Writing model to: C:/r_libs/prophet/libs/x64
Compiling using binary: C:/PROGRA~1/R/R-3.5.1/bin/x64
In file included from C:/r_libs/StanHeaders/include/stan/math/rev/core.hpp:44:0,
                 from C:/r_libs/StanHeaders/include/stan/math/rev/mat.hpp:4,
                 from C:/r_libs/StanHeaders/include/stan/math.hpp:4,
                 from C:/r_libs/StanHeaders/include/src/stan/model/model_header.hpp:4,
                 from file33c8ee71346.cpp:8:
C:/r_libs/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:17: warning: 'void stan::math::set_zero_all_adjoints()' defined but not used [-Wunused-function]
     static void set_zero_all_adjoints() {
                 ^
------ Model successfully compiled!
You can ignore any compiler warnings above.
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'prophet'
    finding HTML links ... done
    add_changepoints_to_plot                html  
 ... 
    validate_inputs                         html  
** building package indices
** installing vignettes
** testing if installed package can be loaded
Fatal error: cannot open file 'C:\Users\Martin': No such file or directory

ERROR: loading failed
* removing 'C:/r_libs/prophet'
* restoring previous 'C:/r_libs/prophet'
In R CMD INSTALL
Installation failed: Command failed (1)

Thanks!

jimhester commented 6 years ago

Try devtools::install(args = "--no-test-load")

However I think you will continue to run into problems down the line, R does not handle paths with spaces very well in many cases. I would suggest making sure you set the installation directory to either a short code of the current path (which won't have spaces), or a different path without them.

martin-smira commented 6 years ago

It worked. Thanks!

stewartli commented 5 years ago

I run into the same problem and found many methods suggested. I spent the whole day and finally solved it with the combination of many things and a little bit luck. Here is what I did for future googlers.

  1. install RRTools properly. library(devtools) find_rtools()
  2. change the environment Sys.setenv(PATH = paste(Sys.getenv("PATH"), "C:/Rtools/bin/", "C:/Rtools/mingw_64/bin", sep = ";")) Sys.setenv(BINPREF = "C:/Rtools/mingw_64/bin/")
  3. configure with c++ .fixdevtools <- function() { httr::set_config( httr::config( ssl_verifypeer = 0L ) ) } .fixdevtools()
  4. change temp file write("TMP = C:/tmp", file=file.path(Sys.getenv('R_USER'), '.Renviron'))
  5. apply Jim Hester's advice devtools::install_github('thomasp85/gganimate', args = "--no-test-load")
  6. final result you will get DONE (gganimate) In R CMD INSTALL References; https://github.com/r-lib/devtools/issues/1772 https://stackoverflow.com/questions/31293325/r-install-github-fails https://github.com/r-lib/devtools/issues/1810
jtfeld commented 5 years ago

After hundreds of seamless package installations via "install and restart" in R Studio, I installed a windows update the other day and now suddenly I'm getting this error. I tried all of the fixes from stewartli and the only one that worked was Jim's suggestion to add args = "--no-test-load". Two questions: 1) could someone kindly elaborate on the "related to whitespace on windows" explanation? 2) I know I can use Project Options > Build Tools to add "--no-test-load" to the Build and Reload options, but what does the test load accomplish when installing a package? I'm running windows 10 64 bit, R 3.5.2, RStudio v1.1.463.

lock[bot] commented 5 years ago

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/