Short summary of the problem:
I have installed R and rstan on my laptop and I am running a stream metabolizer model . And I changed the default libPaths so I set things to install in the right directory. But I am still getting this error " Warning message: In metab_bayes(data = dat, specs(mm_name(“bayes”, err_proc_iid = FALSE), : Modeling failed Warnings: ‘C:/Users/R-34~1.3/rtools40/usr/mingw_/bin/g++’ not found Errors: Multiple results for CXX14FLAGS found, something is wrong.FALSE"
Any idea where this problem is coming from? I tried installing older versions of R and rstan that are compatible, and I also got the same error. I thought it was a version issue, but I am not sure at this stage? The error appears after I run the Bayesian model line below.
mm <- metab_bayes(data=dat,specs(mm_name('bayes', err_proc_iid=FALSE),
n_cores=4, n_chains=5, burnin_steps=500, saved_steps=500))
Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘\server\userhome\students4\My Documents/.R/Makevars’: No such file or directory
Output of devtools::session_info("rstan")
Session info ----------------------------------
setting value
version R version 4.0.3 (2020-10-10)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz Australia/Perth
date 2020-11-09
Yes, the default goes to the university server. But I changed by .libPaths for my packages installation, so every time I make sure I have the right folder by selecting it. I couldn’t have a way around this, cause I don’t have local admin rights on the C drive except for my user folder.
I got this error
Error: Failed to install ‘rstan’ from GitHub:
Git does not seem to be installed on your system.
In addition: Warning message:
In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\AppData\Local\Temp\RtmpOci52S\file451c24de7d26.tar.gz” -C “C:/Users/AppData/Local/Temp/RtmpOci52S/remotes451ca356431”’ returned error code 1
I couldn’t downgrade the withr package. Here is the error I got when I tried to run your
devtools::install_version(“withr”, version=“2.2.0”).
Error: Failed to install ‘unknown package’ from URL:
(converted from warning) installation of package ‘C:/Users/AppData/Local/Temp/RtmpULC9oW/remotes5a8c6978aac/withr’ had non-zero exit status
Error: ‘\U’ used without hex digits in character string starting "“C:\U”
Execution halted
Warning in install.packages :
installation of package ‘C:/Users/AppData/Local/Temp/RtmpSAFfWb/downloaded_packages/withr_2.2.0.tar.gz’ had non-zero exit status
Because I don’t have access to the default location on the computer due to admin right restrictions. So I saved it in a folder I believe that R can access, and set it in the Path. I need to be on the network to be able to work in that manner but due to working from home I can’t access it. So if I can’t install packages from source, what would be another option?
It’s an easy fix, just had to make sure you meant to install it there. The issue is that your BINPREF statement is using backslashes for the directory, you just need to change these to forward-slashes. You can do this from R via:
path = "C:/Users/R-3.4.3/rtools40/mingw$(WIN)/bin/"
writeLines(paste0('Sys.setenv(BINPREF = "',path,'")'), con = "~/.Rprofile")
I tried that and I was able to install withr package finally. Now I tried installing rstan from the source as per the instructions in the link you gave me. But no luck again :(
Here is the error messege I got. Its getting late here, so I will be able to follow up again in about 10-12 hours. Thank you, and talk to you tomorrow my time!
remotes::install_github(“stan-dev/rstan”, ref = “develop”, subdir = “rstan/rstan”, build_opts = “”)
Downloading GitHub repo stan-dev/rstan@develop
stan-dev-rstan-f133b14/StanHeaders/inst/include/libsundials: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c6a1d4920\stan-dev-rstan-f133b14\StanHeaders\inst\include\libsundials’
stan-dev-rstan-f133b14/StanHeaders/inst/include/src: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c6a1d4920\stan-dev-rstan-f133b14\StanHeaders\inst\include\src’
stan-dev-rstan-f133b14/StanHeaders/inst/include/stan: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c6a1d4920\stan-dev-rstan-f133b14\StanHeaders\inst\include\stan’
tar.exe: Error exit delayed from previous errors.
Error: Failed to install ‘rstan’ from GitHub:
Git does not seem to be installed on your system.
In addition: Warning message:
In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\AppData\Local\Temp\Rtmp2rIAAt\file4e8c53a05fb6.tar.gz” -C “C:/Users/AppData/Local/Temp/Rtmp2rIAAt/remotes4e8c6a1d4920”’ returned error code 1
devtools::install_github(“stan-dev/rstan”, ref = “develop”, subdir = “rstan/rstan”, build_opts = “”)
Downloading GitHub repo stan-dev/rstan@develop
stan-dev-rstan-f133b14/StanHeaders/inst/include/libsundials: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c1a9137e4\stan-dev-rstan-f133b14\StanHeaders\inst\include\libsundials’
stan-dev-rstan-f133b14/StanHeaders/inst/include/src: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c1a9137e4\stan-dev-rstan-f133b14\StanHeaders\inst\include\src’
stan-dev-rstan-f133b14/StanHeaders/inst/include/stan: Can’t create ‘\\?\C:\Users\AppData\Local\Temp\Rtmp2rIAAt\remotes4e8c1a9137e4\stan-dev-rstan-f133b14\StanHeaders\inst\include\stan’
tar.exe: Error exit delayed from previous errors.
Error: Failed to install ‘rstan’ from GitHub:
Git does not seem to be installed on your system.
In addition: Warning message:
In utils::untar(tarfile, …) :
‘tar.exe -xf “C:\Users\AppData\Local\Temp\Rtmp2rIAAt\file4e8c6fb01cef.tar.gz” -C “C:/Users/AppData/Local/Temp/Rtmp2rIAAt/remotes4e8c1a9137e4”’ returned error code 1
install.packages(“rstan”, type = “source”)
Installing package into ‘C:/Users/R/R-4.0.3/library’
(as ‘lib’ is unspecified)
trying URL ‘http://cran.rstudio.com/src/contrib/rstan_2.21.2.tar.gz’
Content type ‘application/x-gzip’ length 1152008 bytes (1.1 MB)
downloaded 1.1 MB
installing source package ‘rstan’ …
** package ‘rstan’ successfully unpacked and MD5 sums checked
** using staged installation
** libs