Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation Errors #439

Closed
PritchardAJP opened this issue Jun 3, 2020 · 11 comments
Closed

Installation Errors #439

PritchardAJP opened this issue Jun 3, 2020 · 11 comments

Comments

@PritchardAJP
Copy link

Summary:

Trouble installing on two systems with different operating systems.

Description:

I had Rstan and RStanarm working on a previous build of R (3.6.-). I tried installing the Development version, as I want to access stan_surv for a model I am attempting. Failed to install. Updated my R and Rstudio to the latest versions - purged all packages. Followed instruction to reinstall Rstan (https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started). No issues. Tried installing development version of RStanarm, both with and without vignettes = TRUE, no luck!

Reproducible Steps:

Reproduced this on a different Fedora 30 system, but I think that error is upstream with the C++, G++.

RStanARM Version:

Development

R Version:

4.0.0

Operating System:

Windows 10 (but also tried on Fedora 30)

Errors:

Error Vignettes FALSE
C:/Users/Alex/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/quad_form.hpp:92:5: required from 'void stan::math::internal::quad_form_vari<Ta, Ra, Ca, Tb, Rb, Cb>::chain() [with Ta = double; int Ra = -1; int Ca = -1; Tb = stan::math::var; int Rb = -1; int Cb = 1]'
C:/Users/Alex/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/quad_form.hpp:89:16: required from here
C:/Users/Alex/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:960:8: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::type' {aka '__vector(4) double'} [-Wignored-attributes]

cc1plus.exe: out of memory allocating 2763176 bytes
make: *** [C:/PROGRA1/R/R-401.0/etc/i386/Makeconf:227: stan_files/continuous.o] Error 1
rm stan_files/continuous.cc
ERROR: compilation failed for package 'rstanarm'

  • removing 'C:/Users/Alex/Documents/R/win-library/4.0/rstanarm'
  • restoring previous 'C:/Users/Alex/Documents/R/win-library/4.0/rstanarm'
    Error: Failed to install 'rstanarm' from GitHub:
    (converted from warning) installation of package ‘C:/Users/Alex/AppData/Local/Temp/RtmpIZN646/file21084e907f27/rstanarm_2.19.3.tar.gz’ had non-zero exit status
    In addition: Warning message:
    In utils::untar(tarfile, ...) :
    ‘tar.exe -xf "C:\Users\Alex\AppData\Local\Temp\RtmpIZN646\file21086b6ba7f.tar.gz" -C "C:/Users/Alex/AppData/Local/Temp/RtmpIZN646/remotes21087d2329f3"’ returned error code 1

Error Vignettes TRUE

C:/Users/Alex/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/arch/AVX/Complex.h:387:1: note: in expansion of macro 'EIGEN_MAKE_CONJ_HELPER_CPLX_REAL'
EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cd,Packet4d)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o rstanarm.dll tmp.def stan_files/continuous.o stan_files/mvmer.o stan_files/polr.o stan_files/bernoulli.o stan_files/jm.o stan_files/count.o stan_files/binomial.o stan_files/lm.o init.o -LC:/Users/Alex/Documents/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -ltbbmalloc -LC:/PROGRA1/R/R-401.0/bin/x64 -lR
rm stan_files/jm.cc stan_files/binomial.cc stan_files/lm.cc stan_files/continuous.cc stan_files/bernoulli.cc stan_files/polr.cc stan_files/count.cc stan_files/mvmer.cc
installing to C:/Users/Alex/AppData/Local/Temp/RtmpWSND4y/Rinst22cc50e8444f/00LOCK-rstanarm/00new/rstanarm/libs/x64
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package 'rstanarm'
*** installing help indices
converting help for package 'rstanarm'
finding HTML links ... done
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for 'rstanarm' in inDL(x, as.logical(local), as.logical(now), ...):
unable to load shared object 'C:/Users/Alex/AppData/Local/Temp/RtmpWSND4y/Rinst22cc50e8444f/00LOCK-rstanarm/00new/rstanarm/libs/x64/rstanarm.dll':
LoadLibrary failure: The specified module could not be found.

Error: loading failed
Execution halted
ERROR: loading failed

  • removing 'C:/Users/Alex/AppData/Local/Temp/RtmpWSND4y/Rinst22cc50e8444f/rstanarm'
    -----------------------------------
    ERROR: package installation failed
    Error: Failed to install 'rstanarm' from GitHub:
    System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
    E> Error: package or namespace load failed for 'rstanarm' in inDL(x, as.logical(local), as.logical(now), ...):
    E> unable to load shared object 'C:/Users/Alex/AppData/Local/Temp/RtmpWSND4y/Rinst22cc50e8444f/00LOCK-rstanarm/00new/rstanarm/libs/x64/rstanarm.dll':
    E> LoadLibrary failure: The specified module could not be found.
    E>
    E> Error: loading failed
    E> Execution halted
    E> ERROR: loading failed
    E> * removing 'C:/Users/Alex/AppData/Local/Temp/RtmpWSND4y/Rinst22cc50e8444f/rstanarm'
    E> -----------------------------------
    E> ERROR: package installation failed
    In addition: Warning message:
    In utils::untar(tarfile, ...) :
    ‘tar.exe -xf "C:\Users\Alex\AppData\Local\Temp\RtmpIZN646\file210867033528.tar.gz" -C "C:/Users/Alex/AppData/Local/Temp/RtmpIZN646/remotes210870c87fa8"’ returned error code 1
@PritchardAJP
Copy link
Author

PritchardAJP commented Jun 4, 2020

Just a follow-up - I am still unable to get this to work. I was concerend that devtools install_github was trying to go through a bad download.file.method, so I tried cycling through those (wininet, curl, libcurl, auto). I ended up manually downloading a zip of the the feature/surv from https://github.com/stan-dev/rstanarm/tree/feature/survival . Then using devtools::install_local to use that zip. I run into a similar error on the Windows 10 machine.

For the Fedora machine, I ended up doing a wipe on it and installing a clean system Fedora 32. I got the rstanarm development version to work, BUT still no go on the feature/survival. I will update if I get that system to work.

On the Windows machine, I ran build_vignettes both as false and true, similar errors at the same line.
install_local("~/surv.zip", build_vignettes = FALSE)

C:/Users/Alex/Documents/R/win-library/4.0/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:22:10: required from here
C:/Users/Alex/Documents/R/win-library/4.0/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument 'Eigen::internal::packet_traits::type' {aka '__vector(4) double'} [-Wignored-attributes]

cc1plus.exe: out of memory allocating 4926368 bytes
make: *** [C:/PROGRA1/R/R-401.0/etc/i386/Makeconf:227: stan_files/surv.o] Error 1
rm stan_files/surv.cc
ERROR: compilation failed for package 'rstanarm'

  • removing 'C:/Users/Alex/Documents/R/win-library/4.0/rstanarm'
    Error: Failed to install 'surv.zip' from local:
    (converted from warning) installation of package ‘C:/Users/Alex/AppData/Local/Temp/RtmpsF81IQ/remotes23bc60405830/rstanarm-feature-survival’ had non-zero exit status

So, I seem to need more memory for CC1Plus on the Windows machine - it's running 64-bit architecture. I have a large page file set, and the machine has 4 gig RAM - not a lot, but thought it would be enough?

Any ideas for a workaround, preferably with additional instructions on how to undo said workaround?

@jgabry
Copy link
Member

jgabry commented Jun 9, 2020

Sorry it's not working for you!

In my comment at #429 (comment) I linked to some comments on the Stan forums from @bgoodri that helped a Windows users else get this installed. I'm not sure this is the same exact issue but maybe.

If that's not the issue then perhaps the 4 GB of RAM isn't enough for the compilation (I think the feature/survival branch consumes a decent bit more RAM than the master branch). In that case ideally maybe somebody could build you Windows binary of the feature/survival branch to install. I'm on mac unfortunately, but if you ask on the Stan forums a windows user might be able to help out with that. Sorry for the hassle!

@rok-cesnovar @sambrilleman This could be a good candidate for the new https://github.com/stan-dev/r-packages. We could host binaries of the feature/survival branch since a lot of people want to use it but it's not on CRAN and it's not easy to install via install_github().

@PritchardAJP
Copy link
Author

Thanks very much for the response! Yes, I had followed your instructions. I also tried purging my .Rprofile and changing the R_INSTALL_TAR/tar environment variable. I guess Windows sometimes blocks permissions. I reinstalled Rstan and played around with the version of StanHeaders. I am having issues, too, on my Fedora 32 system, but I assume those errors are upstream.

Thanks for the other potential option; I did not realize people could build packages for Windows installation. I have asked a friend to try running one version of my model. If that works, then I will pursue this suggestion, since I will need to run about 30 more models.

I really appreciate the time you took to respond!

@sambrilleman
Copy link
Collaborator

@jgabry cheers, yeah I wasn't aware of https://github.com/stan-dev/r-packages. That could be a great idea! Perhaps later this week I will look into it. Yeah the whole survival dev branch installation problem is a headache that keeps cropping up. I am on a Windows machine so maybe I can make a Windows binary, although each time I've tried to build a binary in the past I've encountered some form of error, but will try give it another crack! 😃

@jgabry
Copy link
Member

jgabry commented Jun 16, 2020

@sambrilleman Sounds good! We should definitely try to provide an easy way to install the survival branch until it's CRAN-able. In terms of building the windows binary, if you can't build that successfully then maybe open an issue at https://github.com/stan-dev/r-packages and @rok-cesnovar or @serban-nicusor-toptal may be able to help. Unfortunately I'm pretty useless when it comes to Windows.

@anddis
Copy link

anddis commented Jul 12, 2020

Mac binaries for the feature/survival branch would be much appreciated too! 🙏🏻

(On my machine (macOS 10.14.6 + R 3.6.3), I managed to install the feature/survival branch. However, I was unable to do so after upgrading to R 4.0.2).

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘rstanarm’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/anddis/Library/R/4.0/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so':
  dlopen(/Users/anddis/Library/R/4.0/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so, 6): Symbol not found: __ZN20model_polr_namespace24csr_matrix_times_vector2IdN4stan4math3varEEEN5Eigen6MatrixIN5boost4math5tools12promote_argsIT_T0_ffffE4typeELin1ELi1ELi0ELin1ELi1EEERKiSG_RKNS5_ISA_Lin1ELi1ELi0ELin1ELi1EEERKNSt3__16vectorIiNSK_9allocatorIiEEEESQ_RKNS5_ISB_Lin1ELi1ELi0ELin1ELi1EEEPNSK_13basic_ostreamIcNSK_11char_traitsIcEEEE
  Referenced from: /Users/anddis/Library/R/4.0/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so
  Expected in: flat namespace
 in /Users/anddis/Library/R/4.0/library/00LOCK-rstanarm/00new/rstanarm/libs/rstanarm.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/anddis/Library/R/4.0/library/rstanarm’
Error: Failed to install 'rstanarm' from GitHub:
  (converted from warning) installation of package ‘/var/folders/20/frdftm5x0cz3wz5rvdgws18c0000gp/T//RtmpiqKfwh/filea9b2e07b214/rstanarm_2.19.1.tar.gz’ had non-zero exit status

@jgabry
Copy link
Member

jgabry commented Jul 21, 2020

@sambrilleman When you have a chance can you update the feature/survival branch with the changes from master (hopefully there aren't many conflicts)? I think that's probably necessary in order for us to build working binaries.

@sambrilleman
Copy link
Collaborator

@jgabry No worries! It may have to be this weekend if it is a big-ish job.

@jgabry
Copy link
Member

jgabry commented Jul 21, 2020

Ok cool, thanks!

@sambrilleman
Copy link
Collaborator

Hey @jgabry -- looks like @bgoodri has already updated feature/survival with the latest changes from master. Hopefully that went smoothly. Let me know if there is anything I can do to assist.

I still can't build either master or feature/survival from source on my local machine though. I tried the installation instructions mentioned for rstan but encountered a 404 error on the rstan binary. I can install the CRAN versions of rstan and rstanarm and run the example model, but I can't build from source. I'll just sit tight for now until some of the Windows issues are resolved.

fyi, the error I am getting when trying to build rstanarm master from source is:

==> roxygen2::roxygenize('.', roclets = c('rd', 'collate', 'namespace'))

Loading rstanarm
Re-compiling rstanarm
-  installing *source* package 'rstanarm' ... (365ms)
   ** using staged installation
   cp: cannot overwrite non-directory 'tests/testthat/stan_files' with directory 'src/stan_files'
   cp: cannot overwrite non-directory 'tests/testthat/include' with directory 'inst/include'
   ** libs
   "C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
   Wrote C++ file "stan_files/continuous.cc"
   
   
   C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'C:/Program Files/R/R-4.0.2/library/StanHeaders/include' -I'C:/Program Files/R/R-4.0.2/library/rstan/include' -I'C:/Program Files/R/R-4.0.2/library/BH/include' -I'C:/Program Files/R/R-4.0.2/library/Rcpp/include' -I'C:/Program Files/R/R-4.0.2/library/RcppEigen/include' -I'C:/Program Files/R/R-4.0.2/library/RcppParallel/include'     `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "StanHeaders:::CxxFlags()"`   -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2  -c stan_files/continuous.cc -o stan_files/continuous.o
   g++.exe: error: Files/R/R-4.0.2/library/RcppParallel/include": No such file or directory
   make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:227: stan_files/continuous.o] Error 1
   rm stan_files/continuous.cc
   ERROR: compilation failed for package 'rstanarm'
-  removing 'C:/Users/SBRILL~1/AppData/Local/Temp/Rtmp6jlzvV/devtools_install_21bc1f475483/rstanarm'

Error: System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * installing *source* package 'rstanarm' ...
E> ** using staged installation
E> cp: cannot overwrite non-directory 'tests/testthat/stan_files' with directory 'src/stan_files'
E> cp: cannot overwrite non-directory 'tests/testthat/include' with directory 'inst/include'
E> ** libs
E> "C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
E> Wrote C++ file "stan_files/continuous.cc"
E> 
E> 
E> C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'C:/Program Files/R/R-4.0.2/library/StanHeaders/include' -I'C:/Program Files/R/R-4.0.2/library/rstan/include' -I'C:/Program Files/R/R-4.0.2/library/BH/include' -I'C:/Program Files/R/R-4.0.2/library/Rcpp/include' -I'C:/Program Files/R/R-4.0.2/library/RcppEigen/include' -I'C:/Program Files/R/R-4.0.2/library/RcppParallel/include'     `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "StanHeaders:::CxxFlags()"`   -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2  -c stan_files/continuous.cc -o stan_files/continuous.o
E> g++.exe: error: Files/R/R-4.0.2/library/RcppParallel/include": No such file or directory
E> make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:227: stan_files/continuous.o] Error 1
E> rm stan_files/continuous.cc
E> ERROR: compilation failed for package 'rstanarm'
E> * removing 'C:/Users/SBRILL~1/AppData/Local/Temp/Rtmp6jlzvV/devtools_install_21bc1f475483/rstanarm'

 Stack trace:

 1. base:::suppressPackageStartupMessages({ ...
 2. base:::withCallingHandlers(expr, packageStartupMessage = function(c) tryInv ...
 3. roxygen2::roxygenize(".", roclets = c("rd", "collate", "namespace"))
 4. roxygen2:::load_code(base_path)
 5. pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
 6. pkgbuild::compile_dll(path, quiet = quiet)
 7. pkgbuild:::install_min(path, dest = install_dir, components = "libs",  ...
 8. pkgbuild:::rcmd_build_tools("INSTALL", c(path, paste("--library=",  ...
 9. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env,  ...
 10. withr::with_path(rtools_path(), code)
 11. base:::force(code)
 12. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE,  ...
 13. callr:::run_r(options)
 14. base:::with(options, with_envvar(env, do.call(processx::run,  ...
 15. base:::with.default(options, with_envvar(env, do.call(processx::run,  ...
 16. base:::eval(substitute(expr), data, enclos = parent.frame())
 17. base:::eval(substitute(expr), data, enclos = parent.frame())
 18. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmd ...
 19. base:::force(code)
 20. base:::do.call(processx::run, c(list(bin, args = real_cmdargs,  ...
 21. (function (command = NULL, args = character(), error_on_status = TRUE,  ...
 22. throw(new_process_error(res, call = sys.call(), echo = echo,  ...

 x System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * installing *source* package 'rstanarm' ...
E> ** using staged installation
E> cp: cannot overwrite non-directory 'tests/testthat/stan_files' with directory 'src/stan_files'
E> cp: cannot overwrite non-directory 'tests/testthat/include' with directory 'inst/include'
E> ** libs
E> "C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/continuous.stan
E> Wrote C++ file "stan_files/continuous.cc"
E> 
E> 
E> C:/Rtools/mingw_64/bin/g++ -m64 -std=c++1y -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"../inst/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'C:/Program Files/R/R-4.0.2/library/StanHeaders/include' -I'C:/Program Files/R/R-4.0.2/library/rstan/include' -I'C:/Program Files/R/R-4.0.2/library/BH/include' -I'C:/Program Files/R/R-4.0.2/library/Rcpp/include' -I'C:/Program Files/R/R-4.0.2/library/RcppEigen/include' -I'C:/Program Files/R/R-4.0.2/library/RcppParallel/include'     `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-40~1.2/bin/x64/Rscript" -e "StanHeaders:::CxxFlags()"`   -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2  -c stan_files/continuous.cc -o stan_files/continuous.o
E> g++.exe: error: Files/R/R-4.0.2/library/RcppParallel/include": No such file or directory
E> make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:227: stan_files/continuous.o] Error 1
E> rm stan_files/continuous.cc
E> ERROR: compilation failed for package 'rstanarm'
E> * removing 'C:/Users/SBRILL~1/AppData/Local/Temp/Rtmp6jlzvV/devtools_install_21bc1f475483/rstanarm' 

Execution halted

Exited with status 1.

@jgabry
Copy link
Member

jgabry commented Jul 27, 2020

Can you try installing the RStan binaries again that @bgoodri linked to on discourse? I think @bgoodri updated the links in that discourse post and you shouldn't get a 404 anymore. I bet that's probably necessary for you to be able to compile this (at least I think so).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants