stan-dev / cmdstanr

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

Windows Error: install_cmdstan #1029

Open brianperdomo opened 1 week ago

brianperdomo commented 1 week ago

Describe the bug

I'm attempting a fresh installation of cmdstanr on Windows and I get the following error: (FYI: The overwrite is because I tried again after the first error)

cmdstanr::install_cmdstan(overwrite = TRUE)

The C++ toolchain required for CmdStan is setup properly!
trying URL 'https://api.github.com/repos/stan-dev/cmdstan/releases/latest'
downloaded 15 KB

* Latest CmdStan release is v2.35.0
* Installing CmdStan v2.35.0 in C:\Users\brian/.cmdstan/cmdstan-2.35.0
* Downloading cmdstan-2.35.0.tar.gz from GitHub...
* Removing the existing installation of CmdStan...
trying URL 'https://github.com/stan-dev/cmdstan/releases/download/v2.35.0/cmdstan-2.35.0.tar.gz'
Content type 'application/octet-stream' length 51682840 bytes (49.3 MB)
downloaded 49.3 MB

* Download complete
* Unpacking archive...
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file 'C:\Users\brian/.cmdstan/cmdstan-2.35.0/make/local': No such file or directory

I checked that path and the problem is that the actual path should be "C:\Users\brian\.cmdstsan\cmdstan-2.35.0\cmdstan-2.35.0\make\local"

I've tried to find ways to get it to point to the right directory, but I'm at a loss.

To Reproduce cmdstan::install_cmdstan()

Expected behavior Either the archive needs to be unpacked in a way that matches the expected cmdstan_path() without the duplication of cmdstan-2.35.0 or cmdstan_path() should point to the path with the duplicate.... probably the former makes more sense.

Operating system Windows 11

CmdStanR version number

tried with the version 0.8.1 from CRAN and the development version from github

Additional context R 4.4.1, Rtools44

jgabry commented 6 days ago

So is the difference in the paths just the slashes? I'm not a Windows user, so maybe @rok-cesnovar or @andrjohns will have an idea about why that's happening.

I checked that path and the problem is that the actual path should be "C:\Users\brian.cmdstsan\cmdstan-2.35.0\cmdstan-2.35.0\make\local"

I assume .cmdstsan is a typo or do you really have an extra "s" in the path? That would definitely cause a problem, but guessing that's just a typo.

jgabry commented 6 days ago

Oh actually I see there’s two instances of cmdstan-2.35.0 in the path that you say is the correct one. That’s strange. Do you know why that’s the case?

brianperdomo commented 5 days ago

Sorry, the .cmdstsan was a typo. The issue is the duplication of the cmdstan-2.35.0 directory in the path.

I have not been able to figure out the issue. I'll try to take a look this weekend to see if I can find other clues. Are there any settings or other diagnostics I should check that could be informative?

jgabry commented 5 days ago

I don’t think I’ve seen this particular issue with the path before. A couple things to try if you’re not able to figure out why that’s happening:

brianperdomo commented 2 days ago

Deleting .cmdstan and repeating the install function did not work, but I was able to unpack and rebuild cmdstan like you suggested. Thanks!

jgabry commented 2 days ago

I'm still not sure what the source of the problem is, but glad you got it running successfully using that workaround!