CDCgov / ww-inference-model

An in-development R package and a Bayesian hierarchical model jointly fitting multiple "local" wastewater data streams and "global" case count data to produce nowcasts and forecasts of both observations
https://cdcgov.github.io/ww-inference-model/
Apache License 2.0
16 stars 2 forks source link

Windows error with initial compiling #217

Open arranhamlet opened 3 hours ago

arranhamlet commented 3 hours ago

Describe the bug A rather annoying bug that appears to occur because Windows has not included the Rtools environment in its paths. I've found a solution, and flagging here in case this happens to other people who are running the package for the first time.

To Reproduce Steps to reproduce the behavior:

  1. Installing Rtools, cmdstanr and ww-inference on my CDC VAP.
  2. Successful install of required packages.
  3. Running compile_model() produces the following error
INFO: Could not find files for the given pattern(s).

mingw32-make.exe: Interrupt/Exception caught (code = 0xc0000005, addr = 0x00007ffb221f746b)

Error: An error occured during compilation! See the message above for more information.

Solution Add new PATH to the windows environment. The issue appears to be that CmdStanR doesnt know where the mingw32-make.exe file is which is required to compile the model.

  1. Type "environment" in the Windows search bar - click on "Edit the system environment variables".
  2. This will open a "System Properties" window on the "Advanced" tab.
  3. Click on "Environment Variables" on the bottom right.
  4. Click on the variable "Path" and then click edit.
  5. Click "New" and then paste in the file path to the folder within your Rtools folder called "mingw64". I.e. C:\rtools44\mingw64.
  6. Click okay.

After completing these steps, compile_model() was able to run successfully.

Session info image

kaitejohnson commented 2 hours ago

@arranhamlet Thank you for documenting this! Is this the way to do what is instructed here https://mc-stan.org/docs/cmdstan-guide/installation.html#rtools44 (Specifically: "Next, you need to add the toolchain directory to your PATH variable"), but for make? Or basically, how did you figure this out :)

arranhamlet commented 2 hours ago

Yes, that is the expanded version of what they say to do. I didn't know how to "add the toolchain directory to your PATH variable", until I found these more helpful step-by-step instructions here:

https://www.maxmantei.com/2020/05/16/cmdstanr-windows/ https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

kaitejohnson commented 1 hour ago

Yeah that direction is not very intuitive... Hmm I am wondering if we should create a little FAQ guide to document some of these work arounds attached to this package... thoughts @dylanhmorris ? I know its just replicating solutions already on the internet somewhere, but can be helpful to have a sort of "if you get this error when doing this, try this and heres a link to the source"?