Hi
I'm really hoping someone can help. I am having problems running models in brms, and realised that rstan isn't installed properly. I totally uninstalled r and rstudio, and reinstalled it
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 3.1
year 2023
month 06
day 16
svn rev 84548
language R
version.string R version 4.3.1 (2023-06-16)
nickname Beagle Scouts
mode
[1] "desktop"
$version
[1] ‘2023.6.1.524’
$long_version
[1] "2023.06.1+524"
$release_name
[1] "Mountain Hydrangea"
I try to install rstan:
> install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
Warning in install.packages :
unable to access index for repository https://mc-stan.org/r-packages/bin/macosx/big-sur-arm64/contrib/4.3:
cannot open URL 'https://mc-stan.org/r-packages/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES'
trying URL 'http://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.3/rstan_2.21.8.tgz'
Content type 'application/x-gzip' length 21545569 bytes (20.5 MB)
==================================================
downloaded 20.5 MB
The downloaded binary packages are in
/var/folders/vd/pb0tbmfn17j_spybl3qmrzrw0000gn/T//Rtmp9mxjNx/downloaded_packages
I have tried:
- I totally uninstalled r and rstudio, and reinstalled it . No change
2 .uncheck the configuration option: Global option -> Packages->Use secure download method for HTTP.No change - I tried example models
example(stan_model, package = "rstan", run.dontrun = TRUE)
which gives a popup: > R Install Build Tools, Building R package from source requires installation of additional build tools.
Do you want to install the additional tools now?
If I click 'yes' I get:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
sh: /usr/local/Cellar/gcc/7.2.0/bin/g++-7: No such file or directoryusing SDK: ‘’/bin/sh: /usr/local/Cellar/gcc/7.2.0/bin/g++-7: No such file or directorymake: *** [file34bf4883bfe4.o] Error 127
>
- remove and reinstall packages
remove.packages(c("StanHeaders", "rstan"))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
I get the same errors.
-
Where is stanheaders stored? I run:
system.file("include", "src", "stan", "model", "model_header.hpp", package = "StanHeaders")
[1] "/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp"
-
What is the compilation argument (suggested on a different site)
example(stan_model, package = "rstan", run.dontrun = TRUE)
gives:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
sh: /usr/local/Cellar/gcc/7.2.0/bin/g++-7: No such file or directoryusing SDK: ‘’/bin/sh: /usr/local/Cellar/gcc/7.2.0/bin/g++-7: No such file or directorymake: *** [file37de8f7c8f6.o] Error 127
- I uninstalled and reinstalled Xcode. I have version 14.3.1
8 Check g++ in the terminal:
$g++ --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I don't understand what is happening and would be so grateful for any help!