Win7: Can't find stanc.exe when using cmdstanr::install_cmdstan() [solved]

Operating System: Windows 7 (yeah, I know…)
Interface Version: cmdstanr 0.0.0.9000
Compiler/Toolkit: RTools 3.5

C:\Users\win7\Documents>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=C:/Rtools/mingw_64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.3/lto-wrapper.exe
Target: x86_64-w64-mingw32
...
Thread model: posix
gcc version 4.9.3 (x86_64-posix-seh, Built by MinGW-W64 project)

When using install_cmdstan() I get this error message, which I don’t really understand.

g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include  -D_USE_MATH_DEFINES  -DBOOST_DISABLE_ASSERTS      -c -MT bin/cmdstan/lang/grammars/bare_type_grammar_inst.o -MT stan/src/stan/lang/grammars/bare_type_grammar_inst.d -M -E -MG -MP -MF stan/src/stan/lang/grammars/bare_type_grammar_inst.d stan/src/stan/lang/grammars/bare_type_grammar_inst.cpp
INFORMATION: Es konnten keine Dateien mit dem angegebenen
Muster gefunden werden.
g++ -std=c++1y -m64 -D_REENTRANT -Wall -Wno-unused-function -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-variable -Wno-sign-compare -Wno-unused-local-typedefs      -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.72.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include  -D_USE_MATH_DEFINES  -DBOOST_DISABLE_ASSERTS      -c -o bin/cmdstan/stansummary.o src/cmdstan/stansummary.cpp
curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe
make/stanc:51: recipe for target 'bin/stanc.exe' failed
process_begin: CreateProcess(NULL, curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make.exe: *** [bin/stanc.exe] Error 2
mingw32-make.exe: *** Waiting for unfinished jobs....

Warning message:
There was a problem during installation. See the error message(s) above.

The German bits just say that it can’t find the files with this pattern (line 2-3 above) and that the system can’t find the file (line 8 above). I think at least the second is referring to bin/stanc.exe, right?

It’s probably something obvious, but I’m not that well versed with these kind of things…

Maybe @jonah or @rok_cesnovar can come to my rescue?

Cheers!
Max

ps: I think I said it before, but cmdstanr is really awesome (it works on my other Win10 laptop)! :)

More Info:

>bash --version
GNU bash, version 4.3.42(5)-release (x86_64-pc-msys)
>mingw32-make --version
GNU Make 4.1
Built for x86_64-w64-mingw32
1 Like

the error message indicates that for some reason, the install step which downloads the stanc.exe file from GitHub failed.

I would suggest trying to install the release version v2.22.1:

install_cmdstan(release_url="https://github.com/stan-dev/cmdstan/releases/download/v2.22.1/cmdstan-2.22.1.tar.gz")

good luck!

Thanks @mitzimorris, but unfortunately running install_cmdstan(release_url="https://github.com/stan-dev/cmdstan/releases/download/v2.22.1/cmdstan-2.22.1.tar.gz", overwrite = TRUE) resulted in the same error. :(

error that you can’t download from GitHub - similar to error above or exactly the same?

make/stanc:51: recipe for target 'bin/stanc.exe' failed
process_begin: CreateProcess(NULL, curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make.exe: *** [bin/stanc.exe] Error 2
mingw32-make.exe: *** Waiting for unfinished jobs....

I think it’s the exact same:

curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe
make/stanc:51: recipe for target 'bin/stanc.exe' failed
process_begin: CreateProcess(NULL, curl -L https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc -o bin/stanc.exe, ...) failed.
make (e=2): Das System kann die angegebene Datei nicht finden.
mingw32-make.exe: *** [bin/stanc.exe] Error 2

OK, I see at least one problem - the release doesn’t include a pre-compiled windows exe.
in addition to problem that there’s no nightly download build for windows available either.
investigating.

1 Like

hi @Max_Mantei -

could you do me a favor and check whether or not you can download either of the following URLs:

https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc
https://github.com/stan-dev/stanc3/releases/download/v2.22.1/windows-stanc

I see why things are failing for the v2.22.1 release - there was a bug in the makefile which has since been fixed. the question is why are the downloads from the nightly release failing? @serban-nicusor or @rok_cesnovar?

the workaround would require you to copy a few files and change executable perms - if you can download the windows-stanc file, then you want to copy it to path .cmdstanr/cmdstan/bin/stanc3.exe and change file permissions - chmod +x - i.e., make it executable.

1 Like

just to clarify, by default, CmdStanR creates directory "$HOME/.cmdstanr " and inside that, you have directories name cmdstan for whatever you get from CmdStan develop branch from github, or the specified release name. the stanc compiler is found in a subdir named bin.

putting that together, the file you need to have is “$HOME/.cmdstanr/cmdstan/bin/stanc.exe” and it needs to be runnable - is this clear?

1 Like

Hey

https://github.com/stan-dev/stanc3/releases/tag/nightly seems to be working fine for me.
also both of these work
https://github.com/stan-dev/stanc3/releases/download/nightly/windows-stanc
https://github.com/stan-dev/stanc3/releases/download/v2.22.1/windows-stanc

Am I missing something ?

I think the problem is Windows 7 doesnt have curl yet.

2 Likes

same here - they work for me.
OTOH, looking at CmdStan 2.22.1 release tarball - the windows-stanc exe is missing.

~/tmp> tar zxf cmdstan-2.22.1.tar.gz 
~/tmp> ls cmdstan-2.22.1/bin
linux-stanc	mac-stanc

will file an issue for you

not sure if this is worth fixing - the makefile had a bug as well.

Yes, that is why we decided to not include the windows binary.

1 Like

@Max_Mantei You have 2 options:

Oh and thanks for the kind words!

2 Likes

Both work.

This is clear, thank you. However, the process is a bit weird, because everytime I run install_cmdstan I have to run it with overwrite = TRUE. I can’t manually put the stanc.exe there before the error. So it downloads, tries to install and throws the error. I think I need to manually install cmdstan then?

Also, what’s a bit weird: I could use install_cmdstan() just fine on my Windows 10 laptop a few weeks ago…

Aha!

Will try this! Thank you!

1 Like

Make sure curl --version works from the command line and you should be good to go.

2 Likes

I just had to add C:\Program Files\Git\mingw64\bin\ to PATH to make curl work and this did the trick! Thank you for that prompt reply and the super helpful link!

Thank you @mitzimorris for lookin into this. You helped me understand what was going on. Also, thanks to @serban-nicusor for checking in.

Hope you’re all safe! Cheers! :)
Max

4 Likes