Giter Site home page Giter Site logo

Ulam/cmdstan errors about rethinking HOT 11 OPEN

Lawbarnes avatar Lawbarnes commented on June 28, 2024
Ulam/cmdstan errors

from rethinking.

Comments (11)

torkar avatar torkar commented on June 28, 2024 1

Many times working in a OneDrive directory is not good.

from rethinking.

rmcelreath avatar rmcelreath commented on June 28, 2024

Yeah, my guess too is that OneDrive is the problem, given the error message. But I have no experience with OneDrive.

from rethinking.

Lawbarnes avatar Lawbarnes commented on June 28, 2024

Thanks. I moved the cmdstan file to a local drive then change the path with set_cmdstan_path(), but I got the same error message. I guess R keeps looking in OneDrive. Still trying to figure out how to fix that.

from rethinking.

rok-cesnovar avatar rok-cesnovar commented on June 28, 2024

If you just moved the files, that won't work most likely, you need to rebuild cmdstan.

I would actually just run

cmdstanr::install_cmdstan(dir = "THE_NON_ONEDRIVE_DIRECTORY")

And run that. If that does not help, please let me know and we can debug further.

from rethinking.

torkar avatar torkar commented on June 28, 2024

Also make sure to set your work directory to a dir outside OneDrive (I use setwd() in an R terminal)

from rethinking.

Lawbarnes avatar Lawbarnes commented on June 28, 2024

Thank you. I really appreciate your help. I ran

cmdstanr::install_cmdstan(dir = "THE_NON_ONEDRIVE_DIRECTORY")

And got the same error. Here's more details on the error. I don't know enough about R to decipher it. I can't tell if the error is originating in rethinking then flowing down. Honestly, I don't know what's going on.

Error in (function (command = NULL, args = character(), error_on_status = TRUE, …:
! System command 'make' failed

Exit status: 2
Stderr:
make: *** /c/Users/lbarnes/OneDrive: Is a directory. Stop.

Backtrace:

  1. rethinking::ulam(alist(log_gdp_std ~ dnorm(mu, sigma), mu <- a[cid] + b[cid] …
  2. cmdstanr::cmdstan_model(stan_file = filex[[1]], compile = filex[[3]], cpp_o…
  3. CmdStanModel$new(stan_file = stan_file, exe_file = exe_file, …
  4. local initialize(...)
  5. self$compile(...)
  6. cmdstanr:::get_cmdstan_flags("STANCFLAGS")
  7. cmdstanr:::wsl_compatible_run(command = "make", args = c(paste0("print-", …
  8. base::do.call(processx::run, run_args)
  9. (function (command = NULL, args = character(), error_on_status = …
  10. processx:::throw(new_process_error(res, call = sys.call(), echo = echo, …

from rethinking.

bardolater avatar bardolater commented on June 28, 2024

This behavior looks a lot like the one I just posted, except I'm not using OneDrive and my Cmdstan path is set to:

/Users/bardolater/.cmdstan/cmdstan-2.31.0

from rethinking.

torkar avatar torkar commented on June 28, 2024

@bardolater I guess you've done cmdstanr::install_cmdstan(overwrite=TRUE)?
@Lawbarnes have you asked about this at https://discourse.mc-stan.org?

from rethinking.

bardolater avatar bardolater commented on June 28, 2024

from rethinking.

stashlee00 avatar stashlee00 commented on June 28, 2024

Hello, I'm a coding novice and have a similar problem to Lawbarnes that I would really appreciate help with. Everything was going smoothly until R code 9.14. I've tried many different solutions posted online, including reinstalling Rstan and CmdStanR many different ways, but still no success, although the errors I get when running code 9.14 have evolved. I'm running R version 4.3.0 in Windows 11. Below is a brief summary of some of the errors I have gotten and solutions I have tried. Thanks in advance!

1st error: could not find function "ulam"
Installing Rstan via the code below (from https://github.com/stan-dev/rstan/wiki/Configuring-C---Toolchain-for-Windows) seemed to fix this:
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

2nd error: CmdStan path has not been set yet. See ?set_cmdstan_path.
After trying different ways of installing CmdStanR the error changed to...

3rd error: Can't find CmdStan makefile to detect version number. Path may not point to valid installation.
After trying still other ways of installing CmdStanR the error changed to...

4th error: Rtools42 was not found but is required to run CmdStan with R version 4.3.0.
Please install Rtools42 and run cmdstanr::check_cmdstan_toolchain().

Then I added the following to PATH under System Variables:
C:\rtools43
C:\rtools43\mingw64\bin
C:\rtools43\usr\bin
C:\Users\z3389438\AppData\Local\R\win-library\4.3\cmdstanr\cmdstan-2.32.2
C:\Users\z3389438\AppData\Local\R\win-library\4.3\cmdstanr\cmdstan-2.32.2\stan\lib\stan_math\lib\tbb

And I ran the following in Rtools43 Bash (from https://discourse.mc-stan.org/t/problem-installing-cmdstan-with-r4-2-and-rtools42/28846/5)
rm -rf /var/cache/pacman/pkg/*
rm -r /etc/pacman.d/gnupg/
pacman-key --init
pacman-key --populate msys2
pacman -S msys2-keyring
pacman -Syyu
pacman -Sy mingw-w64-ucrt-x86_64-make mingw-w64-ucrt-x86_64-gcc
pacman -Syu mingw-w64-x86_64-make

5th error: Compiling Stan program...
Error in process_initialize(self, private, command, args, stdin, stdout, …:
! Native call to processx_exec failed
Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …:
! Command 'mingw32-make.exe' not found @win/processx.c:982 (processx_exec)
Type .Last.error to see the more details.

.Last.error
<c_error/rlib_error_3_0/rlib_error/error>
Error in process_initialize(self, private, command, args, stdin, stdout, …:
! Native call to processx_exec failed
Caused by error in chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …:
! Command 'mingw32-make.exe' not found @win/processx.c:982 (processx_exec)


Backtrace:

  1. rethinking::ulam(alist(log_gdp_std ~ dnorm(mu, sigma), mu <- a[cid] + b[cid] * …
  2. cmdstanr::cmdstan_model(stan_file = filex[[1]], compile = filex[[3]], cpp_options = cpp_options, …
  3. CmdStanModel$new(stan_file = stan_file, exe_file = exe_file, …
  4. local initialize(...)
  5. self$compile(...)
  6. withr::with_path(c(toolchain_PATH_env_var(), tbb_path()), run_log <- wsl_compatible_run(com…
  7. base::force(code)
  8. cmdstanr:::wsl_compatible_run(command = make_cmd(), args = c(wsl_safe_path(tmp_exe), …
  9. base::do.call(processx::run, run_args)
  10. (function (command = NULL, args = character(), error_on_status = TRUE, …
  11. process$new(command, args, echo_cmd = echo_cmd, wd = wd, windows_verbatim_args = windows_ve…
  12. local initialize(...)
  13. processx:::process_initialize(self, private, command, args, stdin, stdout, …
  14. processx:::chain_call(c_processx_exec, command, c(command, args), pty, pty_options, …
  15. | base::withCallingHandlers(do.call(".Call", list(.NAME, ...)), error = function(e) { …
  16. | base::do.call(".Call", list(.NAME, ...))
  17. | base::.handleSimpleError(function (e) …
  18. | local h(simpleError(msg, call))
  19. | processx:::throw_error(err, parent = e)

from rethinking.

stashlee00 avatar stashlee00 commented on June 28, 2024

I found a solution to this problem caused by institutional use of OneDrive over at the Stan forums [https://discourse.mc-stan.org/t/system-command-make-failed-models-wont-compile/30528/18?u=stashlee00]. All I needed to do was delete the empty folder that starts with “OneDrive”:

C:\Users\first-last\OneDrive (I deleted this one which was empty)
C:\Users\first-last\OneDrive - MMC (This one had OneDrive files in it - I did not delete it)

from rethinking.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.