Problem Installing RStan

286 views
Skip to first unread message

Jalaj Bhandari

unread,
Jun 25, 2015, 5:59:33 PM6/25/15
to stan-...@googlegroups.com
Hi friends,


I am having trouble installing RStan.

R - Version 3.1.2
OS X - Yosemite Version 10.10.3
XCode Version 6.3.2
R Studio - Version 0.98.1091


I have a 64-bit RStudio version so I execute:  Sys.setenv(R_ARCH = '/x86_64') and so R_ARCH is not empty. I upgraded my OS X to Yosemite to install the latest XCode version.

I set the number of cores to 4 - Sys.setenv(MAKEFLAGS = "-j4")

I then proceed to install RStan

source('http://mc-stan.org/rstan/install.R', echo = TRUE, max.deparse.length = 2000)
install_rstan()
This I what i see in the console:

> install_rstan <- function() {
+   on.exit(Sys.unsetenv("R_MAKEVARS_USER"))
+   on.exit(Sys.unsetenv("R_MAKEVARS_SITE"), add = TRUE)
+   try(remove.packages("rstan"), silent = TRUE)
+   Sys.setenv(R_MAKEVARS_USER = "foobar")
+   Sys.setenv(R_MAKEVARS_SITE = "foobar")
+   install.packages(c("inline", "RcppEigen"))
+   install.packages("Rcpp", type = "source")
+   library(inline) 
+   library(Rcpp)
+   src <- ' 
+     std::vector<std::string> s; 
+     s.push_back("hello");
+     s.push_back("world");
+     return Rcpp::wrap(s);
+   '
+   hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
+   test <- try(hellofun())
+   if(inherits(test, "try-error")) stop("hello world failed; ask for help on Rcpp list")
+   options(repos = c(getOption("repos"), 
+           rstan = "http://rstan.org/repo/"))
+   install.packages("rstan", type = 'source', dependencies = FALSE)
+   library(rstan)
+   set_cppo("fast")
+   if (any(grepl("^darwin", R.version$os, ignore.case = TRUE))) {
+     cat('\nCC=clang', 'CXX=clang++ -arch x86_64 -ftemplate-depth-256', 
+         file = "~/.R/Makevars", sep = "\n", append = TRUE)
+   }
+   return(invisible(NULL))
+ }
> install_rstan()
Removing package from ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rstan’
Content type 'application/x-gzip' length 90593 bytes (88 Kb)
opened URL
==================================================
downloaded 88 Kb

Content type 'application/x-gzip' length 3885638 bytes (3.7 Mb)
opened URL
==================================================
downloaded 3.7 Mb


The downloaded binary packages are in
/var/folders/x7/mdj6334j0sgbwzzm29x3dds80000gn/T//RtmpDAmpaV/downloaded_packages
Error in loadNamespace(name) : there is no package called ‘devtools’
Called from: eval(expr, envir, enclos)
Browse[1]> 





The error seems to be in the devtools part.


Please help.

Thanks
Jalaj

Ben Goodrich

unread,
Jun 25, 2015, 6:01:31 PM6/25/15
to stan-...@googlegroups.com, jalajb...@gmail.com
First do

install.packages("devtools")

Then

install_rstan()

Ben

Jalaj Bhandari

unread,
Jun 25, 2015, 6:26:07 PM6/25/15
to stan-...@googlegroups.com, jalajb...@gmail.com
Thanks Ben. I tried that and this is the new error i get:


> install_rstan()
Removing package from ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rstan’
Content type 'application/x-gzip' length 90593 bytes (88 Kb)
opened URL
==================================================
downloaded 88 Kb

Content type 'application/x-gzip' length 3885638 bytes (3.7 Mb)
opened URL
==================================================
downloaded 3.7 Mb


The downloaded binary packages are in
/var/folders/x7/mdj6334j0sgbwzzm29x3dds80000gn/T//RtmpKeTxBK/downloaded_packages
Installing BH
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore  \
  CMD INSTALL  \
  '/private/var/folders/x7/mdj6334j0sgbwzzm29x3dds80000gn/T/RtmpKeTxBK/devtools8d14751c3a1/BH'  \
  --library='/Library/Frameworks/R.framework/Versions/3.1/Resources/library' --install-tests 

/Library/Frameworks/R.framework/Resources/bin/R: line 140: /Library/Frameworks/R.framework/Resources/etc/x86_64/ldpaths: No such file or directory
Error: Command failed (1)
Called from: top level 

Ben Goodrich

unread,
Jun 25, 2015, 7:09:59 PM6/25/15
to stan-...@googlegroups.com, jalajb...@gmail.com
Someone with Mavericks or at least OS X would have to help you figure out why it is looking for a non-existent

/Library/Frameworks/R.framework/Resources/etc/x86_64/ldpaths

Ben

Bob Carpenter

unread,
Jun 25, 2015, 7:20:42 PM6/25/15
to stan-...@googlegroups.com, jalajb...@gmail.com
I have Yosemite and it doesn't have that file.

$ ls /Library/Frameworks/R.framework/Resources/etc/
Makeconf Renviron javaconf ldpaths repositories

So there's no x86_64 in the path. So there's an ldpaths,
but no x86_64 directory.

- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jiqiang Guo

unread,
Jun 25, 2015, 8:37:42 PM6/25/15
to stan-...@googlegroups.com
Try not to set environment variable R_ARCH and/or try to install it not in RStudio. 


Jiqiang 

On Jun 25, 2015, at 5:59 PM, Jalaj Bhandari <jalajb...@gmail.com> wrote:

 Sys.setenv(R_ARCH = '/x86_64')

Jalaj Bhandari

unread,
Jun 26, 2015, 3:13:34 PM6/26/15
to stan-...@googlegroups.com
I set the environment variable R_ARCH to blank and it works. Thanks!
Reply all
Reply to author
Forward
0 new messages