Multiple definition problem - example stan_model won't run

Hi all,

I can’t get the example stan model to run example(stan_model, run.dontrun = TRUE).

It looks like a multiple definition problem with ld.exe. I’ve tried re-installing R, all my packages, and reinstalling Rtools. I’ve tried installed different versions of R (R.4.0.2, R.4.0.3, R.4.0.0), rolling back packages back to previous versions, updated my makevars file to a variety of different things, none of which have helped.

The code is:

example(stan_model, run.dontrun = TRUE)

The full output is attached, the brief error output is below:

[output.txt|attachment](upload://3KHnGRknSHO1aE5IDE8n4aO9HFz.txt) (35.4 KB) Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/usr/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::P1'; file1988d8e1c9b.o:file1988d8e1c9b.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/usr/mingw_64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::QS'; file1988d8e1c9b.o:file1988d8e1c9b.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeE

Note this output occurs with no Makevars file, but I’ve also tried running this again with a variety of options set in the Makevars file, containing different versions of the following, based on potential solutions I found online. In short, none of these made a difference anyway, so I’ve copied the output from above without any Makevars file settings. But, here are the different options I tried in Makevars (not really sure what I’m doing here, so I tried everything that made sense to me at the time based on what I read).

#LDFLAGS += -Wl,--allow-multiple-definition
#CXX14 = "C:\rtools40\usr\mingw_64\bin\g++.exe" -m$(WIN) -std=c++1y
#CXX14FLAGS += -mtune=native -O3, --allow-multiple-definition -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
#CXX11FLAGS=-O3 -march=native
#CXX14FLAGS=-O3 -march=native
#CXXFLAGS=-O3 -Wno-unused-variable -Wno-unused-function
#CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations
#CXX14 = g++

Session info is:

- Session info ---------------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_Australia.1252      
 ctype    English_Australia.1252      
 tz       Australia/Sydney            
 date     2021-01-12                  

- Packages -------------------------------------------------------------------------------------------------------------------------------------------------------
 package      * version   date       lib source        
 assertthat     0.2.1     2019-03-21 [1] CRAN (R 4.0.3)
 backports      1.2.0     2020-11-02 [1] CRAN (R 4.0.3)
 BH             1.75.0-0  2021-01-11 [1] CRAN (R 4.0.2)
 brio           1.1.0     2020-08-31 [1] CRAN (R 4.0.3)
 callr          3.5.1     2020-10-13 [1] CRAN (R 4.0.3)
 checkmate      2.0.0     2020-02-06 [1] CRAN (R 4.0.3)
 cli            2.2.0     2020-11-20 [1] CRAN (R 4.0.3)
 colorspace     2.0-0     2020-11-11 [1] CRAN (R 4.0.3)
 crayon         1.3.4     2017-09-16 [1] CRAN (R 4.0.3)
 curl           4.3       2019-12-02 [1] CRAN (R 4.0.3)
 desc           1.2.0     2018-05-01 [1] CRAN (R 4.0.3)
 diffobj        0.3.3     2021-01-07 [1] CRAN (R 4.0.3)
 digest         0.6.27    2020-10-24 [1] CRAN (R 4.0.3)
 ellipsis       0.3.1     2020-05-15 [1] CRAN (R 4.0.3)
 evaluate       0.14      2019-05-28 [1] CRAN (R 4.0.3)
 fansi          0.4.1     2020-01-08 [1] CRAN (R 4.0.3)
 farver         2.0.3     2020-01-16 [1] CRAN (R 4.0.3)
 ggplot2      * 3.3.3     2020-12-30 [1] CRAN (R 4.0.3)
 glue           1.4.2     2020-08-27 [1] CRAN (R 4.0.3)
 gridExtra      2.3       2017-09-09 [1] CRAN (R 4.0.3)
 gtable         0.3.0     2019-03-25 [1] CRAN (R 4.0.3)
 inline         0.3.17    2020-12-01 [1] CRAN (R 4.0.3)
 isoband        0.2.3     2020-12-01 [1] CRAN (R 4.0.3)
 jsonlite       1.7.2     2020-12-09 [1] CRAN (R 4.0.3)
 labeling       0.4.2     2020-10-20 [1] CRAN (R 4.0.3)
 lattice        0.20-41   2020-04-02 [2] CRAN (R 4.0.2)
 lifecycle      0.2.0     2020-03-06 [1] CRAN (R 4.0.3)
 loo            2.4.1     2020-12-09 [1] CRAN (R 4.0.3)
 magrittr       2.0.1     2020-11-17 [1] CRAN (R 4.0.3)
 MASS           7.3-51.6  2020-04-26 [2] CRAN (R 4.0.2)
 Matrix         1.2-18    2019-11-27 [2] CRAN (R 4.0.2)
 matrixStats    0.57.0    2020-09-25 [1] CRAN (R 4.0.3)
 mgcv           1.8-31    2019-11-09 [2] CRAN (R 4.0.2)
 munsell        0.5.0     2018-06-12 [1] CRAN (R 4.0.3)
 nlme           3.1-148   2020-05-24 [2] CRAN (R 4.0.2)
 pillar         1.4.7     2020-11-20 [1] CRAN (R 4.0.3)
 pkgbuild       1.2.0     2020-12-15 [1] CRAN (R 4.0.3)
 pkgconfig      2.0.3     2019-09-22 [1] CRAN (R 4.0.3)
 pkgload        1.1.0     2020-05-29 [1] CRAN (R 4.0.3)
 praise         1.0.0     2015-08-11 [1] CRAN (R 4.0.3)
 prettyunits    1.1.1     2020-01-24 [1] CRAN (R 4.0.3)
 processx       3.4.5     2020-11-30 [1] CRAN (R 4.0.3)
 ps             1.5.0     2020-12-05 [1] CRAN (R 4.0.3)
 R6             2.5.0     2020-10-28 [1] CRAN (R 4.0.3)
 RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 4.0.3)
 Rcpp         * 1.0.5     2020-07-06 [1] CRAN (R 4.0.3)
 RcppEigen      0.3.3.9.1 2020-12-17 [1] CRAN (R 4.0.3)
 RcppParallel   5.0.2     2020-06-24 [1] CRAN (R 4.0.2)
 rematch2       2.1.2     2020-05-01 [1] CRAN (R 4.0.3)
 rlang          0.4.10    2020-12-30 [1] CRAN (R 4.0.3)
 rprojroot      2.0.2     2020-11-15 [1] CRAN (R 4.0.3)
 rstan        * 2.21.2    2020-07-27 [1] CRAN (R 4.0.3)
 rstudioapi     0.13      2020-11-12 [1] CRAN (R 4.0.3)
 scales         1.1.1     2020-05-11 [1] CRAN (R 4.0.3)
 StanHeaders  * 2.21.0-7  2020-12-17 [1] CRAN (R 4.0.3)
 testthat       3.0.1     2020-12-17 [1] CRAN (R 4.0.3)
 tibble         3.0.4     2020-10-12 [1] CRAN (R 4.0.3)
 utf8           1.1.4     2018-05-24 [1] CRAN (R 4.0.3)
 V8             3.4.0     2020-11-04 [1] CRAN (R 4.0.3)
 vctrs          0.3.6     2020-12-17 [1] CRAN (R 4.0.3)
 viridisLite    0.3.0     2018-02-01 [1] CRAN (R 4.0.3)
 waldo          0.2.3     2020-11-09 [1] CRAN (R 4.0.3)
 withr          2.2.0     2020-04-20 [1] CRAN (R 4.0.2)

[1] C:/SLAFolder/R
[2] C:/Program Files/R/R-4.0.2/library

My Operating System is Windows 10 Education.

Any advice would be really helpful. I can run models with brms and rstan on my other windows machine, but this machine is much more powerful, and I need to utilise its cores to speed up the models.

Thanks very much for any help!

output.txt (35.4 KB)

Here is the full output of the error (I couldn’t see it in the post…)

I’m getting the same error.

Windows 10
R version 4.0.3 (2020-10-10)

Loading required package: StanHeaders
Loading required package: ggplot2
rstan (Version 2.21.2, GitRev: 2e1f913d3ca3)
For execution on a local, multicore CPU with excess RAM we recommend calling
options(mc.cores = parallel::detectCores()).
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)
Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file
Loading required package: Rcpp
Loading 'brms' package (version 2.14.4). Useful instructions
can be found by typing help('brms'). A more detailed introduction
to the package is available through vignette('brms_overview').

Attaching package: 'brms'

The following object is masked from 'package:rstan':

    loo

The following object is masked from 'package:stats':

    ar

Loading required package: usethis
Compiling Stan program...
make cmd is
  make -f "C:/Users/abreucbr/R-40~1.3/etc/x64/Makeconf" -f "C:/Users/abreucbr/R-40~1.3/share/make/winshlib.mk" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="filed986bcd5aab.dll" WIN=64 TCLBIN=64 OBJECTS="filed986bcd5aab.o"

make would use
if test "zfiled986bcd5aab.o" != "z"; then \
  if test -e "filed986bcd5aab-win.def"; then \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o filed986bcd5aab.dll filed986bcd5aab-win.def filed986bcd5aab.o   "C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/abreucbr/R-4.0.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/abreucbr/R-4.0.3/library/RcppParallel/lib/x64" -ltbb  -L"C:/Users/abreucbr/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o filed986bcd5aab.dll filed986bcd5aab-win.def filed986bcd5aab.o   "C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/abreucbr/R-4.0.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/abreucbr/R-4.0.3/library/RcppParallel/lib/x64" -ltbb  -L"C:/Users/abreucbr/R-40~1.3/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    "C:/rtools40/mingw64/bin/"nm filed986bcd5aab.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o filed986bcd5aab.dll tmp.def filed986bcd5aab.o   "C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/abreucbr/R-4.0.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/abreucbr/R-4.0.3/library/RcppParallel/lib/x64" -ltbb  -L"C:/Users/abreucbr/R-40~1.3/bin/x64" -lR ; \
    "C:/rtools40/mingw64/bin/"g++  -shared -s -static-libgcc -o filed986bcd5aab.dll tmp.def filed986bcd5aab.o   "C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a" -L"C:/Users/abreucbr/R-4.0.3/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/abreucbr/R-4.0.3/library/RcppParallel/lib/x64" -ltbb  -L"C:/Users/abreucbr/R-40~1.3/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::P1'; filed986bcd5aab.o:filed986bcd5aab.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/abreucbr/R-4.0.3/library/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::QS'; filed986bcd5aab.o:filed986bcd5aab.cpp:(.rdata$_ZZN5bo

It looks like the recent update to the BH package has broken something with RStan, I’ve found success by reinstalling RStan and StanHeaders from source:

install.packages(c("rstan","StanHeaders"),type="source")

Can you see if that works for you?

Thanks a lot! That worked for me.

Installing from binaries didn’t work:

install.packages(pkgs=c("rstan","StanHeaders"), type = "win.binary", dependencies = TRUE)

But now I’m getting the same error I used to get before as I explained in my other thread.

I can install StanHeaders from source, but not rstan. I get the following when I try to do so:

devtools::install_local(".../rstan_2.21.2.zip", type="source")
Installing package into ‘C:/SLAFolder/R’
(as ‘lib’ is unspecified)
* installing *binary* package 'rstan' ...
cp: unknown option -- )
Try '/usr/bin/cp --help' for more information.
ERROR: installing binary package failed
* removing 'C:/SLAFolder/R/rstan'
* restoring previous 'C:/SLAFolder/R/rstan'
Error: Failed to install 'rstan' from local:
  (converted from warning) installation of package ‘...AppData/Local/Temp/Rtmpe4qWWq/remotes3b1478cf52fa/rstan’ had non-zero exit status

I can install rstan like this:

install.packages("rstan", repos = "https://cloud.r-project.org/", dependencies = TRUE)

Afterward, I get this error message:

example(stan_model, package = "rstan", run.dontrun = TRUE)
stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE)
TRANSLATING MODEL '73fc79f8b1915e8208c736914c86d1a1' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '73fc79f8b1915e8208c736914c86d1a1'.
COMPILING THE C++ CODE FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW.
OS: x86_64, mingw32; rstan: 2.21.2; Rcpp: 1.0.5; inline: 0.3.17 
Error in cleanup_makevar(old) : 
  argument "RMU" is missing, with no default

I read here (New error: cleanup_makevar(old) : argument "RMU" is missing, with no default - #16 by HCOKSTATE) that the solution is to rollback to withr 2.2.0. I tried that with the following:
devtools::install_version(“withr”, version=“2.2.0”) But upon doing so, get the same multiple definitions error as previously encountered:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::P1'; file1f1066413716.o:file1f1066413716.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2P1]+0x0): first defined hereC:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/SLAFolder/R/rstan/lib/x64/libStanServices.a(stan_fit.o):stan_fit.cpp:(.data$_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS[_ZZN5boost4math6detail9bessel_j0IeEET_S3_E2QS]+0x0): multiple definition of `boost::math::detail::bessel_j0<long double>(long double)::QS'; file1f1066413716.o:file1f1066413716.cpp:(.rdata$_ZZN5boost4math6detail9bessel_j0IeEET_S3_

Try:

install.packages(c("rstan","StanHeaders"),type="source")

This is very annoying and unstable… :( I keep having to reinstall packages and figure out why my scripts stop running with every update or R install.

Compiling Stan program...
Warning message:
In system(paste(cmd, "-n")) : 'make' not found
Start sampling
starting worker pid=20204 on localhost:11547 at 20:20:46.398
starting worker pid=10416 on localhost:11547 at 20:20:46.580
starting worker pid=7828 on localhost:11547 at 20:20:46.743
starting worker pid=24384 on localhost:11547 at 20:20:46.905

SAMPLING FOR MODEL '8e37c05852032f401718489ece46f645' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 4000 [  0%]  (Warmup)
Chain 1: Iteration:  400 / 4000 [ 10%]  (Warmup)
Chain 1: Iteration:  800 / 4000 [ 20%]  (Warmup)
Chain 1: Iteration: 1200 / 4000 [ 30%]  (Warmup)
Chain 1: Iteration: 1600 / 4000 [ 40%]  (Warmup)

SAMPLING FOR MODEL '8e37c05852032f401718489ece46f645' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 0 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 4000 [  0%]  (Warmup)
Chain 1: Iteration: 2000 / 4000 [ 50%]  (Warmup)
Chain 1: Iteration: 2001 / 4000 [ 50%]  (Sampling)
Chain 2: Iteration:  400 / 4000 [ 10%]  (Warmup)
Chain 1: Iteration: 2400 / 4000 [ 60%]  (Sampling)
Chain 2: Iteration:  800 / 4000 [ 20%]  (Warmup)
Chain 2: Iteration: 1200 / 4000 [ 30%]  (Warmup)
Chain 1: Iteration: 2800 / 4000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 4000 [ 40%]  (Warmup)
Chain 1: Iteration: 3200 / 4000 [ 80%]  (Sampling)
Chain 2: Iteration: 2000 / 4000 [ 50%]  (Warmup)
Chain 2: Iteration: 2001 / 4000 [ 50%]  (Sampling)
Chain 1: Iteration: 3600 / 4000 [ 90%]  (Sampling)
Chain 2: Iteration: 2400 / 4000 [ 60%]  (Sampling)

SAMPLING FOR MODEL '8e37c05852032f401718489ece46f645' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 0 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 4000 [  0%]  (Warmup)
Chain 2: Iteration: 2800 / 4000 [ 70%]  (Sampling)
Chain 1: Iteration: 4000 / 4000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.16 seconds (Warm-up)
Chain 1:                0.215 seconds (Sampling)
Chain 1:                0.375 seconds (Total)
Chain 1: 
Chain 2: Iteration: 3200 / 4000 [ 80%]  (Sampling)
Chain 2: Iteration: 3600 / 4000 [ 90%]  (Sampling)
Chain 3: Iteration:  400 / 4000 [ 10%]  (Warmup)
Chain 2: Iteration: 4000 / 4000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.156 seconds (Warm-up)
Chain 2:                0.176 seconds (Sampling)
Chain 2:                0.332 seconds (Total)
Chain 2: 
Chain 3: Iteration:  800 / 4000 [ 20%]  (Warmup)
Chain 3: Iteration: 1200 / 4000 [ 30%]  (Warmup)

SAMPLING FOR MODEL '8e37c05852032f401718489ece46f645' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 0 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 4000 [  0%]  (Warmup)
Chain 3: Iteration: 1600 / 4000 [ 40%]  (Warmup)
Chain 4: Iteration:  400 / 4000 [ 10%]  (Warmup)
Chain 3: Iteration: 2000 / 4000 [ 50%]  (Warmup)
Chain 3: Iteration: 2001 / 4000 [ 50%]  (Sampling)
Chain 4: Iteration:  800 / 4000 [ 20%]  (Warmup)
Chain 3: Iteration: 2400 / 4000 [ 60%]  (Sampling)
Chain 3: Iteration: 2800 / 4000 [ 70%]  (Sampling)
Chain 4: Iteration: 1200 / 4000 [ 30%]  (Warmup)
Chain 3: Iteration: 3200 / 4000 [ 80%]  (Sampling)
Chain 4: Iteration: 1600 / 4000 [ 40%]  (Warmup)
Chain 3: Iteration: 3600 / 4000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 4000 [ 50%]  (Warmup)
Chain 4: Iteration: 2001 / 4000 [ 50%]  (Sampling)
Chain 3: Iteration: 4000 / 4000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.227 seconds (Warm-up)
Chain 3:                0.146 seconds (Sampling)
Chain 3:                0.373 seconds (Total)
Chain 3: 
Chain 4: Iteration: 2400 / 4000 [ 60%]  (Sampling)
Chain 4: Iteration: 2800 / 4000 [ 70%]  (Sampling)
Chain 4: Iteration: 3200 / 4000 [ 80%]  (Sampling)
Chain 4: Iteration: 3600 / 4000 [ 90%]  (Sampling)
Chain 4: Iteration: 4000 / 4000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.175 seconds (Warm-up)
Chain 4:                0.146 seconds (Sampling)
Chain 4:                0.321 seconds (Total)
Chain 4: 

==== C stack trace ===============================

	(No symbol) [0x0x5b0fba0]
	R_RunWeakRefFinalizer [0x0x6c83326f+383]
	R_RunWeakRefFinalizer [0x0x6c833507+1047]
	R_initAssignSymbols [0x0x6c7f67a9+72761]
	Rf_eval [0x0x6c7fb841+369]
	R_cmpfun1 [0x0x6c7fd547+1191]
	Rf_applyClosure [0x0x6c7fe7aa+442]
	R_initAssignSymbols [0x0x6c7f2994+56868]
	Rf_eval [0x0x6c7fb841+369]
	R_cmpfun1 [0x0x6c7fd547+1191]
	Rf_applyClosure [0x0x6c7fe7aa+442]
	R_initAssignSymbols [0x0x6c7f2994+56868]
	R_forceAndCall [0x0x6c803896+10726]
	R_forceAndCall [0x0x6c803eb6+12294]
	Rf_eval [0x0x6c7fbc25+1365]
	Rf_ReplIteration [0x0x6c824c61+673]
	Rf_ReplIteration [0x0x6c824fc1+1537]
	run_Rmainloop [0x0x6c82505d+77]
	(No symbol) [0x0x4016da]
	(No symbol) [0x0x4038bf]
	(No symbol) [0x0x4013c5]
	(No symbol) [0x0x40152b]
	BaseThreadInitThunk [0x0x7ffcb8f97c24+20]
	RtlUserThreadStart [0x0x7ffcb9d4d4d1+33]

Unfortunately Miniconda just doesn’t play well with RStan, because it interferes with many of the library calls/locations. I think you should give cmdstanR a try

Does that mean I’ll have to uninstall rstan? That may not be great because the script runs on other computers without Miniconda. So it’s just a local issue for me. Do you know if a full Anaconda installation (instead of Miniconda) would be any different?

Sorry I didn’t say - yes, I did try that, it doesn’t work for rstan, but is fine for StanHeaders. Here is the output:
install.packages(c(“rstan”,“StanHeaders”),type=“source”)

"C:/rtools40/mingw32/bin/"ar -rs ../inst/lib//i386/libStanServices.a stan_fit.o stan_fit_base.o
C:\rtools40\mingw32\bin\ar.exe: creating ../inst/lib//i386/libStanServices.a
no DLL was created
ERROR: compilation failed for package 'rstan'
* removing 'C:/SLAFolder/R/rstan'
* restoring previous 'C:/SLAFolder/R/rstan'
Warning in install.packages :
  installation of package ‘rstan’ had non-zero exit status

Hi,
I also faced the same error and the following solved my problem.

remove.packages("BH")
require(devtools)
install_version("BH", version = "1.69.0-1", repos = "http://cran.us.r-project.org")
2 Likes

I’m actually using brms. Will cmdstanr work with brms? It doesn’t seem so (after I removed rstan and StanHeaders).

> library(brms)
Error: package or namespace load failed for ‘brms’ in loadNamespace(j <- imp[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘rstan’

I gave up… downgraded everything to another R (R version 3.5.0 (2018-04-23)) and Rtools versions (copied the folders from another computer to mine).

brms          2.12.0
BH            1.72.0-3
devtools      2.3.0
rstan         2.19.3
StanHeaders   2.21.0-1

I’m not sure it’s Miniconda vs. rstan that’s causing issues. This other computer I referred to has Anaconda and R installed. No interference there. It seems to be a package version issue, not Python vs. R.

Interesting! So when you say ‘no interference’, do you mean no stack trace error? Can you give me some more information about the differences between the two computers?

The outputs from:

  • devtools::session_info("rstan")
  • Sys.getenv("BINPREF")
  • Sys.getenv("PATH")
  • Sys.which("make")
  • readLines("~/.Renviron")

Hopefully there will be configuration differences that will point to a cause

Also, brms will work with cmdstanR. If you just install the rstan binary, so that brms has access to its post-processing functions, you can then run your brms models with the backend="cmdstanr" option

Hm that’s odd. If you just want a working version, then install the RStan & StanHeaders binaries:

install.packages(c("rstan","StanHeaders"))

Then install the older version of BH:

devtools::install_version("BH",version="1.72.0-3")

If you want to troubleshoot the rstan source installation, then can you try removing the rstan and StanHeaders packages, restarting your R session, and then trying the install again? If it still fails, can you copy as much of the installation output as possible and post here? It’s probably simplest to copy it into a text file and then upload that.

1 Like

The following is on the same computer.

  • Working configuration:
> devtools::session_info("rstan")
- Session info ------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/New_York            
 date     2021-01-14                  

- Packages ----------------------------------------------------------
 package      * version   date       lib source        
 assertthat     0.2.1     2019-03-21 [1] CRAN (R 3.5.3)
 backports      1.1.6     2020-04-05 [1] CRAN (R 3.5.3)
 BH             1.72.0-3  2020-01-08 [1] CRAN (R 3.5.3)
 callr          3.4.3     2020-03-28 [1] CRAN (R 3.5.3)
 checkmate      2.0.0     2020-02-06 [1] CRAN (R 3.5.3)
 cli            2.0.2     2020-02-28 [1] CRAN (R 3.5.3)
 colorspace     1.4-1     2019-03-18 [1] CRAN (R 3.5.3)
 crayon         1.3.4     2017-09-16 [1] CRAN (R 3.5.3)
 desc           1.2.0     2018-05-01 [1] CRAN (R 3.5.3)
 digest         0.6.25    2020-02-23 [1] CRAN (R 3.5.3)
 ellipsis       0.3.0     2019-09-20 [1] CRAN (R 3.5.3)
 evaluate       0.14      2019-05-28 [1] CRAN (R 3.5.3)
 fansi          0.4.1     2020-01-08 [1] CRAN (R 3.5.3)
 farver         2.0.3     2020-01-16 [1] CRAN (R 3.5.3)
 ggplot2        3.3.0     2020-03-05 [1] CRAN (R 3.5.3)
 glue           1.4.0     2020-04-03 [1] CRAN (R 3.5.3)
 gridExtra      2.3       2017-09-09 [1] CRAN (R 3.5.3)
 gtable         0.3.0     2019-03-25 [1] CRAN (R 3.5.3)
 inline         0.3.15    2018-05-18 [1] CRAN (R 3.5.3)
 isoband        0.2.1     2020-04-12 [1] CRAN (R 3.5.3)
 labeling       0.3       2014-08-23 [1] CRAN (R 3.5.2)
 lattice        0.20-41   2020-04-02 [1] CRAN (R 3.5.3)
 lifecycle      0.2.0     2020-03-06 [1] CRAN (R 3.5.3)
 loo            2.2.0     2019-12-19 [1] CRAN (R 3.5.3)
 magrittr       1.5       2014-11-22 [1] CRAN (R 3.5.3)
 MASS           7.3-51.5  2019-12-20 [1] CRAN (R 3.5.3)
 Matrix         1.2-18    2019-11-27 [1] CRAN (R 3.5.3)
 matrixStats    0.56.0    2020-03-13 [1] CRAN (R 3.5.3)
 mgcv           1.8-31    2019-11-09 [1] CRAN (R 3.5.3)
 munsell        0.5.0     2018-06-12 [1] CRAN (R 3.5.3)
 nlme           3.1-137   2018-04-07 [1] CRAN (R 3.5.3)
 pillar         1.4.3     2019-12-20 [1] CRAN (R 3.5.3)
 pkgbuild       1.0.6     2019-10-09 [1] CRAN (R 3.5.3)
 pkgconfig      2.0.3     2019-09-22 [1] CRAN (R 3.5.3)
 pkgload        1.0.2     2018-10-29 [1] CRAN (R 3.5.3)
 praise         1.0.0     2015-08-11 [1] CRAN (R 3.5.3)
 prettyunits    1.1.1     2020-01-24 [1] CRAN (R 3.5.3)
 processx       3.4.2     2020-02-09 [1] CRAN (R 3.5.3)
 ps             1.3.2     2020-02-13 [1] CRAN (R 3.5.3)
 R6             2.4.1     2019-11-12 [1] CRAN (R 3.5.3)
 RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 3.5.2)
 Rcpp           1.0.4.6   2020-04-09 [1] CRAN (R 3.5.3)
 RcppEigen      0.3.3.7.0 2019-11-16 [1] CRAN (R 3.5.3)
 rlang          0.4.5     2020-03-01 [1] CRAN (R 3.5.3)
 rprojroot      1.3-2     2018-01-03 [1] CRAN (R 3.5.3)
 rstan          2.19.3    2020-02-11 [1] CRAN (R 3.5.3)
 rstudioapi     0.11      2020-02-07 [1] CRAN (R 3.5.3)
 scales         1.1.0     2019-11-18 [1] CRAN (R 3.5.3)
 StanHeaders    2.21.0-1  2020-01-19 [1] CRAN (R 3.5.3)
 testthat       2.3.2     2020-03-02 [1] CRAN (R 3.5.3)
 tibble         3.0.1     2020-04-20 [1] CRAN (R 3.5.3)
 utf8           1.1.4     2018-05-24 [1] CRAN (R 3.5.3)
 vctrs          0.2.4     2020-03-10 [1] CRAN (R 3.5.3)
 viridisLite    0.3.0     2018-02-01 [1] CRAN (R 3.5.3)
 withr          2.2.0     2020-04-20 [1] CRAN (R 3.5.3)

[1] C:/Users/abreucbr/R/R-3.5.0/library

> Sys.getenv("BINPREF")
[1] ""

> Sys.getenv("PATH")
[1] "C:\\Users\\abreucbr\\R\\R-3.5.0\\bin\\x64;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS;C:\\WINDOWS\\SYSTEM32\\WBEM;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\CheckPoint\\Endpoint Security\\Endpoint Common\\bin;C:\\Program Files\\1E\\Client\\Extensibility\\NomadBranch;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\MATLAB\\R2020b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2020b\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\nodejs\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Users\\abreucbr;C:\\Users\\abreucbr\\Miniconda3;C:\\Users\\abreucbr\\Miniconda3\\Library\\mingw-w64\\bin;C:\\Users\\abreucbr\\Miniconda3\\Library\\usr\\bin;C:\\Users\\abreucbr\\Miniconda3\\Library\\bin;C:\\Users\\abreucbr\\Miniconda3\\Scripts;C:\\Users\\abreucbr\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\abreucbr\\PyCharm Community Edition 2020.3.2\\bin;;C:\\Users\\abreucbr\\AppData\\Roaming\\npm;C:\\Users\\abreucbr\\AppData\\Local\\Yarn\\bin;C:\\RBuildTools\\3.5\\bin;"

> Sys.which("make")
                              make 
"C:\\RBUILD~1\\3.5\\bin\\make.exe" 

> readLines("~/.Renviron")
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:/Users/abreucbr/Documents/.Renviron': No such file or directory
  • Not working configuration:
> 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       America/New_York            
 date     2021-01-14                  

- Packages ----------------------------------------------------------
 ! package      * version   date       lib source        
   assertthat     0.2.1     2019-03-21 [1] CRAN (R 4.0.3)
   backports      1.2.0     2020-11-02 [1] CRAN (R 4.0.3)
   BH             1.75.0-0  2021-01-11 [1] CRAN (R 4.0.3)
   brio           1.1.0     2020-08-31 [1] CRAN (R 4.0.3)
   callr          3.5.1     2020-10-13 [1] CRAN (R 4.0.3)
   checkmate      2.0.0     2020-02-06 [1] CRAN (R 4.0.3)
   cli            2.2.0     2020-11-20 [1] CRAN (R 4.0.3)
   colorspace     2.0-0     2020-11-11 [1] CRAN (R 4.0.3)
   crayon         1.3.4     2017-09-16 [1] CRAN (R 4.0.3)
   curl           4.3       2019-12-02 [1] CRAN (R 4.0.3)
   desc           1.2.0     2018-05-01 [1] CRAN (R 4.0.3)
   diffobj        0.3.2     2020-10-05 [1] CRAN (R 4.0.3)
   digest         0.6.27    2020-10-24 [1] CRAN (R 4.0.3)
   ellipsis       0.3.1     2020-05-15 [1] CRAN (R 4.0.3)
   evaluate       0.14      2019-05-28 [1] CRAN (R 4.0.3)
   fansi          0.4.1     2020-01-08 [1] CRAN (R 4.0.3)
   farver         2.0.3     2020-01-16 [1] CRAN (R 4.0.3)
   ggplot2        3.3.2     2020-06-19 [1] CRAN (R 4.0.3)
   glue           1.4.2     2020-08-27 [1] CRAN (R 4.0.3)
   gridExtra      2.3       2017-09-09 [1] CRAN (R 4.0.3)
   gtable         0.3.0     2019-03-25 [1] CRAN (R 4.0.3)
   inline         0.3.17    2020-12-01 [1] CRAN (R 4.0.3)
   isoband        0.2.3     2020-12-01 [1] CRAN (R 4.0.3)
   jsonlite       1.7.2     2020-12-09 [1] CRAN (R 4.0.3)
   labeling       0.4.2     2020-10-20 [1] CRAN (R 4.0.3)
   lattice        0.20-41   2020-04-02 [1] CRAN (R 4.0.3)
   lifecycle      0.2.0     2020-03-06 [1] CRAN (R 4.0.3)
   loo            2.4.1     2020-12-09 [1] CRAN (R 4.0.3)
   magrittr       2.0.1     2020-11-17 [1] CRAN (R 4.0.3)
   MASS           7.3-53    2020-09-09 [1] CRAN (R 4.0.3)
   Matrix         1.2-18    2019-11-27 [1] CRAN (R 4.0.3)
   matrixStats    0.57.0    2020-09-25 [1] CRAN (R 4.0.3)
   mgcv           1.8-33    2020-08-27 [1] CRAN (R 4.0.3)
   munsell        0.5.0     2018-06-12 [1] CRAN (R 4.0.3)
   nlme           3.1-149   2020-08-23 [1] CRAN (R 4.0.3)
   pillar         1.4.7     2020-11-20 [1] CRAN (R 4.0.3)
   pkgbuild       1.2.0     2020-12-15 [1] CRAN (R 4.0.3)
   pkgconfig      2.0.3     2019-09-22 [1] CRAN (R 4.0.3)
   pkgload        1.1.0     2020-05-29 [1] CRAN (R 4.0.3)
   praise         1.0.0     2015-08-11 [1] CRAN (R 4.0.3)
   prettyunits    1.1.1     2020-01-24 [1] CRAN (R 4.0.3)
   processx       3.4.5     2020-11-30 [1] CRAN (R 4.0.3)
   ps             1.5.0     2020-12-05 [1] CRAN (R 4.0.3)
   R6             2.5.0     2020-10-28 [1] CRAN (R 4.0.3)
   RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 4.0.3)
   Rcpp           1.0.5     2020-07-06 [1] CRAN (R 4.0.3)
   RcppEigen      0.3.3.9.1 2020-12-17 [1] CRAN (R 4.0.3)
 D RcppParallel   5.0.2     2020-06-24 [1] CRAN (R 4.0.3)
   rematch2       2.1.2     2020-05-01 [1] CRAN (R 4.0.3)
   rlang          0.4.9     2020-11-26 [1] CRAN (R 4.0.3)
   rprojroot      2.0.2     2020-11-15 [1] CRAN (R 4.0.3)
   rstan          2.21.2    2020-07-27 [1] CRAN (R 4.0.3)
   rstudioapi     0.13      2020-11-12 [1] CRAN (R 4.0.3)
   scales         1.1.1     2020-05-11 [1] CRAN (R 4.0.3)
   StanHeaders    2.21.0-7  2020-12-17 [1] CRAN (R 4.0.3)
   testthat       3.0.1     2020-12-17 [1] CRAN (R 4.0.3)
   tibble         3.0.4     2020-10-12 [1] CRAN (R 4.0.3)
   utf8           1.1.4     2018-05-24 [1] CRAN (R 4.0.3)
   V8             3.4.0     2020-11-04 [1] CRAN (R 4.0.3)
   vctrs          0.3.6     2020-12-17 [1] CRAN (R 4.0.3)
   viridisLite    0.3.0     2018-02-01 [1] CRAN (R 4.0.3)
   waldo          0.2.3     2020-11-09 [1] CRAN (R 4.0.3)
   withr          2.3.0     2020-09-22 [1] CRAN (R 4.0.3)

[1] C:/Users/abreucbr/R-4.0.3/library

 D -- DLL MD5 mismatch, broken installation.
 
 > Sys.getenv("BINPREF")
[1] ""


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 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       America/New_York            
 date     2021-01-14                  

- Packages ----------------------------------------------------------
 ! package      * version   date       lib source        
   assertthat     0.2.1     2019-03-21 [1] CRAN (R 4.0.3)
   backports      1.2.0     2020-11-02 [1] CRAN (R 4.0.3)
   BH             1.75.0-0  2021-01-11 [1] CRAN (R 4.0.3)
   brio           1.1.0     2020-08-31 [1] CRAN (R 4.0.3)
   callr          3.5.1     2020-10-13 [1] CRAN (R 4.0.3)
   checkmate      2.0.0     2020-02-06 [1] CRAN (R 4.0.3)
   cli            2.2.0     2020-11-20 [1] CRAN (R 4.0.3)
   colorspace     2.0-0     2020-11-11 [1] CRAN (R 4.0.3)
   crayon         1.3.4     2017-09-16 [1] CRAN (R 4.0.3)
   curl           4.3       2019-12-02 [1] CRAN (R 4.0.3)
   desc           1.2.0     2018-05-01 [1] CRAN (R 4.0.3)
   diffobj        0.3.2     2020-10-05 [1] CRAN (R 4.0.3)
   digest         0.6.27    2020-10-24 [1] CRAN (R 4.0.3)
   ellipsis       0.3.1     2020-05-15 [1] CRAN (R 4.0.3)
   evaluate       0.14      2019-05-28 [1] CRAN (R 4.0.3)
   fansi          0.4.1     2020-01-08 [1] CRAN (R 4.0.3)
   farver         2.0.3     2020-01-16 [1] CRAN (R 4.0.3)
   ggplot2        3.3.2     2020-06-19 [1] CRAN (R 4.0.3)
   glue           1.4.2     2020-08-27 [1] CRAN (R 4.0.3)
   gridExtra      2.3       2017-09-09 [1] CRAN (R 4.0.3)
   gtable         0.3.0     2019-03-25 [1] CRAN (R 4.0.3)
   inline         0.3.17    2020-12-01 [1] CRAN (R 4.0.3)
   isoband        0.2.3     2020-12-01 [1] CRAN (R 4.0.3)
   jsonlite       1.7.2     2020-12-09 [1] CRAN (R 4.0.3)
   labeling       0.4.2     2020-10-20 [1] CRAN (R 4.0.3)
   lattice        0.20-41   2020-04-02 [1] CRAN (R 4.0.3)
   lifecycle      0.2.0     2020-03-06 [1] CRAN (R 4.0.3)
   loo            2.4.1     2020-12-09 [1] CRAN (R 4.0.3)
   magrittr       2.0.1     2020-11-17 [1] CRAN (R 4.0.3)
   MASS           7.3-53    2020-09-09 [1] CRAN (R 4.0.3)
   Matrix         1.2-18    2019-11-27 [1] CRAN (R 4.0.3)
   matrixStats    0.57.0    2020-09-25 [1] CRAN (R 4.0.3)
   mgcv           1.8-33    2020-08-27 [1] CRAN (R 4.0.3)
   munsell        0.5.0     2018-06-12 [1] CRAN (R 4.0.3)
   nlme           3.1-149   2020-08-23 [1] CRAN (R 4.0.3)
   pillar         1.4.7     2020-11-20 [1] CRAN (R 4.0.3)
   pkgbuild       1.2.0     2020-12-15 [1] CRAN (R 4.0.3)
   pkgconfig      2.0.3     2019-09-22 [1] CRAN (R 4.0.3)
   pkgload        1.1.0     2020-05-29 [1] CRAN (R 4.0.3)
   praise         1.0.0     2015-08-11 [1] CRAN (R 4.0.3)
   prettyunits    1.1.1     2020-01-24 [1] CRAN (R 4.0.3)
   processx       3.4.5     2020-11-30 [1] CRAN (R 4.0.3)
   ps             1.5.0     2020-12-05 [1] CRAN (R 4.0.3)
   R6             2.5.0     2020-10-28 [1] CRAN (R 4.0.3)
   RColorBrewer   1.1-2     2014-12-07 [1] CRAN (R 4.0.3)
   Rcpp           1.0.5     2020-07-06 [1] CRAN (R 4.0.3)
   RcppEigen      0.3.3.9.1 2020-12-17 [1] CRAN (R 4.0.3)
 D RcppParallel   5.0.2     2020-06-24 [1] CRAN (R 4.0.3)
   rematch2       2.1.2     2020-05-01 [1] CRAN (R 4.0.3)
   rlang          0.4.9     2020-11-26 [1] CRAN (R 4.0.3)
   rprojroot      2.0.2     2020-11-15 [1] CRAN (R 4.0.3)
   rstan          2.21.2    2020-07-27 [1] CRAN (R 4.0.3)
   rstudioapi     0.13      2020-11-12 [1] CRAN (R 4.0.3)
   scales         1.1.1     2020-05-11 [1] CRAN (R 4.0.3)
   StanHeaders    2.21.0-7  2020-12-17 [1] CRAN (R 4.0.3)
   testthat       3.0.1     2020-12-17 [1] CRAN (R 4.0.3)
   tibble         3.0.4     2020-10-12 [1] CRAN (R 4.0.3)
   utf8           1.1.4     2018-05-24 [1] CRAN (R 4.0.3)
   V8             3.4.0     2020-11-04 [1] CRAN (R 4.0.3)
   vctrs          0.3.6     2020-12-17 [1] CRAN (R 4.0.3)
   viridisLite    0.3.0     2018-02-01 [1] CRAN (R 4.0.3)
   waldo          0.2.3     2020-11-09 [1] CRAN (R 4.0.3)
   withr          2.3.0     2020-09-22 [1] CRAN (R 4.0.3)

[1] C:/Users/abreucbr/R-4.0.3/library

 D -- DLL MD5 mismatch, broken installation.
> Sys.getenv("BINPREF")
[1] ""

> Sys.getenv("PATH")
[1] "C:\\Users\\abreucbr\\R-4.0.3\\bin\\x64;C:\\WINDOWS\\SYSTEM32;C:\\WINDOWS;C:\\WINDOWS\\SYSTEM32\\WBEM;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\CheckPoint\\Endpoint Security\\Endpoint Common\\bin;C:\\Program Files\\1E\\Client\\Extensibility\\NomadBranch;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\MATLAB\\R2020b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2020b\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\nodejs\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Users\\abreucbr;C:\\Users\\abreucbr\\Miniconda3;C:\\Users\\abreucbr\\Miniconda3\\Library\\mingw-w64\\bin;C:\\Users\\abreucbr\\Miniconda3\\Library\\usr\\bin;C:\\Users\\abreucbr\\Miniconda3\\Library\\bin;C:\\Users\\abreucbr\\Miniconda3\\Scripts;C:\\Users\\abreucbr\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\abreucbr\\PyCharm Community Edition 2020.3.2\\bin;;C:\\Users\\abreucbr\\AppData\\Roaming\\npm;C:\\Users\\abreucbr\\AppData\\Local\\Yarn\\bin;C:\\rtools40\\usr\\bin;"

> Sys.which("make")
                              make 
"C:\\rtools40\\usr\\bin\\make.exe" 

> readLines("~/.Renviron")
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:/Users/abreucbr/Documents/.Renviron': No such file or directory

Thank you so much! I was at a loss how to handle this issue, and your advice solved my problem.