Re: [problems] Installing [R]stan

124 views
Skip to first unread message

Bob Carpenter

unread,
Oct 16, 2014, 12:37:12 PM10/16/14
to Faiza Khan Khattak, stan-...@googlegroups.com
I'm cc-ing our users list, where our developers who understand
the vagaries of R can help.

It looks like there's something going wrong with your
C++ compiler and the way R's trying to call it.

I have no idea if that's a problem with our install script,
your version of Rcpp, something in your R makevars that got changed,
or what. You may need to re-install R, but I'm not sure.

If you type

> clang++ --version

and

> g++ --version

from a terminal, what do you see?

- Bob

On Oct 16, 2014, at 11:43 AM, Faiza Khan Khattak <fk2...@columbia.edu> wrote:

> I have updated the OS to 10.9.5 and Xcode to version 6.
> Now I am running the command and following is happening
>
>
> > install_rstan()
> Removing package from ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’
> (as ‘lib’ is unspecified)
> trying URL 'http://cran.mirrors.hoobly.com/bin/macosx/contrib/3.1/inline_0.3.13.tgz'
> Content type 'application/x-gzip' length 78503 bytes (76 Kb)
> opened URL
> ==================================================
> downloaded 76 Kb
>
> trying URL 'http://cran.mirrors.hoobly.com/bin/macosx/contrib/3.1/BH_1.54.0-4.tgz'
> Content type 'application/x-gzip' length 6104700 bytes (5.8 Mb)
> opened URL
> ==================================================
> downloaded 5.8 Mb
>
> trying URL 'http://cran.mirrors.hoobly.com/bin/macosx/contrib/3.1/RcppEigen_0.3.2.2.0.tgz'
> Content type 'application/x-gzip' length 3321066 bytes (3.2 Mb)
> opened URL
> ==================================================
> downloaded 3.2 Mb
>
>
> The downloaded binary packages are in
> /var/folders/jx/zyhs78l15511g70c96xvwgd80000gn/T//Rtmpp6B16t/downloaded_packages
> trying URL 'http://cran.mirrors.hoobly.com/src/contrib/Rcpp_0.11.3.tar.gz'
> Content type 'application/x-gzip' length 2169583 bytes (2.1 Mb)
> opened URL
> ==================================================
> downloaded 2.1 Mb
>
> * installing *source* package ‘Rcpp’ ...
> ** package ‘Rcpp’ successfully unpacked and MD5 sums checked
> ** libs
> llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -fPIC -mtune=core2 -g -O2 -c Date.cpp -o Date.o
> llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/include" -fPIC -mtune=core2 -g -O2 -c Module.cpp -o Module.o
> /bin/sh: llvm-g++-4.2: command not found
> make: *** [Date.o] Error 127
> make: *** Waiting for unfinished jobs....
> /bin/sh: llvm-g++-4.2: command not found
> make: *** [Module.o] Error 127
> ERROR: compilation failed for package ‘Rcpp’
> * removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp’
> * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp’
>
> The downloaded source packages are in
> ‘/private/var/folders/jx/zyhs78l15511g70c96xvwgd80000gn/T/Rtmpp6B16t/downloaded_packages’
> /bin/sh: llvm-g++-4.2: command not found
> make: *** [file14f526ae3bf.o] Error 127
>
> ERROR(s) during compilation: source code errors or compiler configuration errors!
>
> Program source:
> 1:
> 2: // includes from the plugin
> 3:
> 4: #include <Rcpp.h>
> 5:
> 6:
> 7: #ifndef BEGIN_RCPP
> 8: #define BEGIN_RCPP
> 9: #endif
> 10:
> 11: #ifndef END_RCPP
> 12: #define END_RCPP
> 13: #endif
> 14:
> 15: using namespace Rcpp;
> 16:
> 17:
> 18: // user includes
> 19:
> 20:
> 21: // declarations
> 22: extern "C" {
> 23: SEXP file14f526ae3bf( ) ;
> 24: }
> 25:
> 26: // definition
> 27:
> 28: SEXP file14f526ae3bf( ){
> 29: BEGIN_RCPP
> 30:
> 31: std::vector<std::string> s;
> 32: s.push_back("hello");
> 33: s.push_back("world");
> 34: return Rcpp::wrap(s);
> 35:
> 36: END_RCPP
> 37: }
> 38:
> 39:
> Error in compileCode(f, code, language = language, verbose = verbose) :
> Compilation ERROR, function(s)/method(s) not created! /bin/sh: llvm-g++-4.2: command not found
> make: *** [file14f526ae3bf.o] Error 127
> In addition: Warning messages:
> 1: In install.packages("Rcpp", type = "source") :
> installation of package ‘Rcpp’ had non-zero exit status
> 2: running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file14f526ae3bf.cpp 2> file14f526ae3bf.cpp.err.txt' had status 1
>
>
>
> Is there anything I am doing wrong?
> Faiza
>
> On Wed, Oct 15, 2014 at 4:43 PM, Bob Carpenter <ca...@alias-i.com> wrote:
> I'm on version 10.9. We support 10.7, 10.8 and 10.9,
> but not 10.6. I'm not even sure it's possible to run
> Stan on Mac OS 10.6.
>
> I'm also pretty sure we need a later version of the
> C++ compilers than are available in Xcode 3. The
> new versions are much faster, by the way, both to compile
> and to run.
>
> Is there some reason you can't update your OS?
> I don't think you can update Xcode to the latest
> version until you update your OS.
>
> If you can't update the OS, maybe you could find a more
> modern Linux server somewhere to run on? Otherwise, you
> probably need to dig down and install a C++ compiler
> from something other than Xcode plus all the tools like
> make and so on.
>
> - Bob
>
>
> On Oct 15, 2014, at 4:36 PM, Faiza Khan Khattak <fk2...@columbia.edu> wrote:
>
> > Mac 10.6.8
> > My Xcode is version 3.2.6
> > I will try restarting.
> > Thanks,
> > Faiza
> >
> > On Wed, Oct 15, 2014 at 4:31 PM, Bob Carpenter <ca...@alias-i.com> wrote:
> > The other thing you might try is looking for a lock file and
> > removing it, then restarting. R's not a very robust platform :-)
> > See Ben's response on:
> >
> > http://stackoverflow.com/questions/23483303/error-failed-to-lock-directory-c-program-files-r-r-3-0-2-library-for-modifyi
> >
> > - Bob
> >
> >
> > On Oct 15, 2014, at 4:22 PM, Faiza Khan Khattak <fk2...@columbia.edu> wrote:
> >
> > > Hi,
> > > I have R-3.1.1 on my mac and I am trying to install STAN.
> > > I did this in R
> > > Sys.setenv(MAKEFLAGS = "-j4")
> > > and this
> > > source('http://mc-stan.org/rstan/install.R', echo = TRUE, max.deparse.length = 2000)
> > >
> > > These two seem to be fine.
> > >
> > > But when I run the following weird thing happens.
> > >
> > > 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’
> > > trying URL 'http://cran.rstudio.com/bin/macosx/contrib/3.1/inline_0.3.13.tgz'
> > > Content type 'application/x-gzip' length 78503 bytes (76 Kb)
> > > opened URL
> > > ==================================================
> > > downloaded 76 Kb
> > >
> > > trying URL 'http://cran.rstudio.com/bin/macosx/contrib/3.1/BH_1.54.0-4.tgz'
> > > Content type 'application/x-gzip' length 6104700 bytes (5.8 Mb)
> > > opened URL
> > > ==================================================
> > > downloaded 5.8 Mb
> > >
> > > trying URL 'http://cran.rstudio.com/bin/macosx/contrib/3.1/RcppEigen_0.3.2.2.0.tgz'
> > > Content type 'application/x-gzip' length 3321066 bytes (3.2 Mb)
> > > opened URL
> > > ==================================================
> > > downloaded 3.2 Mb
> > >
> > >
> > > The downloaded binary packages are in
> > > /var/folders/Xr/XrzcNCWMGZ03tkAGPiyDOU+++TI/-Tmp-//Rtmpm8xFcS/downloaded_packages
> > > trying URL 'http://cran.rstudio.com/src/contrib/Rcpp_0.11.3.tar.gz'
> > > Content type 'application/x-gzip' length 2169583 bytes (2.1 Mb)
> > > opened URL
> > > ==================================================
> > > downloaded 2.1 Mb
> > >
> > > * installing *source* package ‘Rcpp’ ...
> > > ** package ‘Rcpp’ successfully unpacked and MD5 sums checked
> > > ** libs
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c Date.cpp -o Date.o
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c Module.cpp -o Module.o
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c Rcpp_init.cpp -o Rcpp_init.o
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c api.cpp -o api.o
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c attributes.cpp -o attributes.o
> > > llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -I/usr/local/include -fPIC -mtune=core2 -g -O2 -c barrier.cpp -o barrier.o
> > > llvm-g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o Rcpp.so Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
> > > installing to /Library/Frameworks/R.framework/Versions/3.1/Resources/library/Rcpp/libs
> > > ** R
> > > ** inst
> > > ** preparing package for lazy loading
> > > ** help
> > > *** installing help indices
> > > ** building package indices
> > > ** installing vignettes
> > > ** testing if installed package can be loaded
> > > * DONE (Rcpp)
> > >
> > > The downloaded source packages are in
> > > ‘/private/var/folders/Xr/XrzcNCWMGZ03tkAGPiyDOU+++TI/-Tmp-/Rtmpm8xFcS/downloaded_packages’
> > >
> > > Attaching package: ‘Rcpp’
> > >
> > > The following object is masked from ‘package:inline’:
> > >
> > > registerPlugin
> > >
> > > trying URL 'http://rstan.org/repo/src/contrib/rstan_2.4.0.tar.gz'
> > > Content type 'application/x-gzip' length 1399541 bytes (1.3 Mb)
> > > opened URL
> > > ==================================================
> > > downloaded 1.3 Mb
> > >
> > > ERROR: failed to lock directory ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library’ for modifying
> > > Try removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/00LOCK-rstan’
> > > Warning in install.packages :
> > > installation of package ‘rstan’ had non-zero exit status
> > >
> > > The downloaded source packages are in
> > > ‘/private/var/folders/Xr/XrzcNCWMGZ03tkAGPiyDOU+++TI/-Tmp-/Rtmpm8xFcS/downloaded_packages’
> > > Show Traceback
> > >
> > > Rerun with Debug
> > > Error in library(rstan) : there is no package called ‘rstan’
> > > ---------------------------------------
> > > I also tried the following but did not work for me.
> > > options(repos = c(getOption("repos"), rstan = “http://rstan.org/repo/"))
> > > install.packages(“rstan", type = 'source')
> > >
> > > Am I doing the right thing?
> > >
> > > Thanks in advance.
> > > Regards,
> > > Faiza
> >
> >
> >
> >
> > --
> > Regards,
> > Faiza
>
>
>
>
> --
> Regards,
> Faiza

Jiqiang Guo

unread,
Oct 16, 2014, 3:45:36 PM10/16/14
to stan-...@googlegroups.com, fk2...@columbia.edu

I think Bob is right about reinstalling R is a way to solve the problem. In old version of R on Mac, the cpp compiler points to llvm-g++.

Jiqiang

Reply all
Reply to author
Forward
0 new messages