Error when installing CmdStan in Rstudio

Hi there,

I was trying to install cmdstan via Rstudio on Win10 OS. CmdStanR was successfully installed. I also followed https://www.maxmantei.com/2020/05/16/cmdstanr-windows/ to solve the problem of error message telling me that mingw32-make could not be found. However, I still got error when installing cmdstan using install_cmdstan(cores = 2, overwrite=TRUE). Here is the error message, could you please help? Note that my Rtool is indeed installed in C:/Program Files (x86)/rtools40 and I have add path for folders C:/Program Files (x86)/rtools40\usr\bin and C:/Program Files (x86)/rtools40\mingw64\bin

C:/Program Files (x86)/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files (x86)/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find Files: No such file or directory
C:/Program Files (x86)/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find (x86)/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
No such file or directory

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

mingw32-make.exe: *** [make/command:35: stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1
mingw32-make.exe: *** Waiting for unfinished jobs....

Warning messages:
1: In readChar(make_local_path, file.info(make_local_path)$size) :
  can only read in bytes in a non-UTF-8 MBCS locale
2: In readChar(make_local_path, file.info(make_local_path)$size) :
  can only read in bytes in a non-UTF-8 MBCS locale
3: There was a problem during installation. See the error message(s) above.

kind of suspecting this path with Program Files (x86), seems it could not recognize a path with space? but this is the default Rtool installation path.

I don’t have Windows, but I think you are probably be right about the space in the path being an issue. But I thought the default installation path was C:\rtools40, like in the image of the installation window on the Rtools page:

If it’s possible to install it there then that might fix the problem but @rok_cesnovar will know better than I do and may have other ideas.

Thanks. I will try to reinstall Rtool in another folder tomorrow and let you know.

I just reinstalled rtool 4.0, reinstalled cmdstanr, reboot OS. mingw32-make issue is gone but still get the following error

...failed updating 1 target...
...skipped 1 target...
...updated 46 targets...
mingw32-make.exe: *** [make/command:36: stan/lib/stan_math/lib/boost_1.72.0/stage/lib/libboost_program_options*.a] Error 1
mingw32-make.exe: *** Waiting for unfinished jobs....

Warning messages:
1: In readChar(make_local_path, file.info(make_local_path)$size) :
  can only read in bytes in a non-UTF-8 MBCS locale
2: In readChar(make_local_path, file.info(make_local_path)$size) :
  can only read in bytes in a non-UTF-8 MBCS locale
3: There was a problem during installation. See the error message(s) above.

@rok_cesnovar Any ideas? I wonder if this is similar to

@zcai What happens if you just try to run a model? For instance, if you try running one of the example models with

fit <- cmdstanr_example("logistic")

what happens?

I tried the examples in https://mc-stan.org/cmdstanr/articles/cmdstanr.html and it worked without any error. For the moment, I’m going to stay with the current set-up. No idea of these Windows compilers things, also got a lot of problems previously when installing Docker and so on. Maybe one day I will get some errors with a certain model then we will see. or I can get a Mac eventually haha :)

1 Like

Great, glad it’s working!