stan-dev / cmdstanr

CmdStanR: the R interface to CmdStan
https://mc-stan.org/cmdstanr/
Other
139 stars 61 forks source link

CmdStanR Installation Issue #1002

Closed joshliddy closed 1 week ago

joshliddy commented 1 week ago

I've been trying to install CmdStanR (0.8.1), but can't seem to find a workable solution.

I installed the package in R, ensured that RTools is installed and discoverable, checked to ensure the tool chain was installed, and also attempted to build directly in R. Recently, I shifted to directly cloning the GitHub project (cmdstan 2.34.0), initializing the submodules, and then setting the cmdstan path to this location before building. See below for example.

Install cmdstanr

install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev", getOption("repos"))) library(cmdstanr)

Check for RTools

library(devtools) devtools::find_rtools() Sys.getenv("PATH") system("gcc --version") system("make --version")

Make sure the toolchain was installed and if not run the second line.

cmdstanr::check_cmdstan_toolchain()

cmdstanr::check_cmdstan_toolchain(fix = TRUE)

Cloned the git repository (this was done in cmd window to the desired directory)

git clone --branch v2.34.0 https://github.com/stan-dev/cmdstan.git

cd cmdstan

git submodule update --init --recursive

cmdstanr::set_cmdstan_path("C:/Users/jliddy/.cmdstan/cmdstan") cmdstanr::rebuild_cmdstan(cores = 4)

It appears that the issue is due to the tbb library being incompatible with C++20 in its current form. The warnings indicate that template-id is not allowed for constructors in C++20. I've tried downgrading the C++ standard in the make/local file, but this doesn't help. Any suggestions?

andrjohns commented 1 week ago

Just to clarify, you've successfully installed cmdstanr (the R package), but there's a failure when building CmdStan?

Can you post the compilation output with the error, as well as your system details?

joshliddy commented 1 week ago

Correct. CmdStanR is installing with no issues, but building CmdStan is not working.

Example output (the list goes on and on)

INFO: Could not find files for the given pattern(s). curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe --retry 5 --retry-delay 10 g++ -pipe -m64 -D_UCRT -D_REENTRANT -O3 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DNO_FPRINTF_OUTPUT -D_USE_MATH_DEFINES -O3 -c -x c -include stan/lib/stan_math/lib/sundials_6.1.1/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_6.1.1/src/nvector/serial/nvector_serial.c -o stan/lib/stan_math/lib/sundials_6.1.1/src/nvector/serial/nvector_serial.o g++ -pipe -m64 -D_UCRT -D_REENTRANT -O3 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DNO_FPRINTF_OUTPUT -D_USE_MATH_DEFINES -O3 -c -x c -include stan/lib/stan_math/lib/sundials_6.1.1/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_6.1.1/src/sundials/sundials_math.c -o stan/lib/stan_math/lib/sundials_6.1.1/src/sundials/sundials_math.o g++ -pipe -m64 -D_UCRT -D_REENTRANT -O3 -I stan/lib/stan_math/lib/sundials_6.1.1/include -I stan/lib/stan_math/lib/sundials_6.1.1/src/sundials -DNO_FPRINTF_OUTPUT -D_USE_MATH_DEFINES -O3 -c -x c -include stan/lib/stan_math/lib/sundials_6.1.1/include/stan_sundials_printf_override.hpp stan/lib/stan_math/lib/sundials_6.1.1/src/cvodes/cvodea.c -o stan/lib/stan_math/lib/sundials_6.1.1/src/cvodes/cvodea.o % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

System Info[image: image.png]

On Wed, Jun 26, 2024 at 10:46 AM Andrew Johnson @.***> wrote:

Just to clarify, you've successfully installed cmdstanr (the R package), but there's a failure when building CmdStan?

Can you post the compilation output with the error, as well as your system details?

— Reply to this email directly, view it on GitHub https://github.com/stan-dev/cmdstanr/issues/1002#issuecomment-2191896648, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVNQABHORDJAIIBFVX6LQLZJLH37AVCNFSM6AAAAABJ6BWBMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJRHA4TMNRUHA . You are receiving this because you authored the thread.Message ID: @.***>

-- Josh Liddy, Ph.D. Research Assistant Professor Department of Kinesiology University of Massachusetts Amherst Email: @.*** Phone: 413-545-1337

andrjohns commented 1 week ago

Thanks, but I need to actually see the part of the compilation output with the error

joshliddy commented 1 week ago

I just reran and it looks like it might have actually built correctly...

NOTE: Please add C:/Users/jliddy/.cmdstan/cmdstan/stan/lib/stan_math/lib/tbb to your PATH variable. You may call

mingw32-make install-tbb

to automatically update your user configuration. --- CmdStan v2.34.0 built ---

On Wed, Jun 26, 2024 at 11:11 AM Andrew Johnson @.***> wrote:

Thanks, but I need to actually see the part of the compilation output with the error

— Reply to this email directly, view it on GitHub https://github.com/stan-dev/cmdstanr/issues/1002#issuecomment-2191960164, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVNQAE455F6BT43H225CA3ZJLK2BAVCNFSM6AAAAABJ6BWBMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJRHE3DAMJWGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- Josh Liddy, Ph.D. Research Assistant Professor Department of Kinesiology University of Massachusetts Amherst Email: @.*** Phone: 413-545-1337

andrjohns commented 1 week ago

Looks like all built and working, so closing