Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set CMDSTAN environment variable to gloabl .cmdstanr directory rather than version #638

Closed
bwiernik opened this issue Apr 6, 2022 · 4 comments · Fixed by #643
Closed
Labels
feature New feature or request

Comments

@bwiernik
Copy link

bwiernik commented Apr 6, 2022

Is your feature request related to a problem? Please describe.
I have cmdstan installed to a non-default directory (I'm on Windows and the default location is in a cloud storage folder). This means that I have to change my .Renviron every time I install a new version of cmdstan, rather than having the latest version automatically detected.

Describe the solution you'd like
I'd like to be able to set my CMDSTAN variable in .Renviron to be the .cmdstanr directory, rather than specific version directories. That way, the default when I call cmdstan could be to use the latest version in the directory.

To accomplish this, if the CMDSTAN path doesn't contain the CmdStan makefile, the logic from cmdstanr::cmdstan_default_path() would be run in the directory to find the latest version of cmdstan there.

@bwiernik bwiernik added the feature New feature or request label Apr 6, 2022
@bwiernik bwiernik changed the title Set Set CMDSTAN environment variable to gloabl .cmdstanr directory rather than version Apr 6, 2022
@rok-cesnovar
Copy link
Member

Thank you for the feature request Brenton. Seems like a valid use case and a simple fix. Hopefully, I will get to it this week.

@jgabry
Copy link
Member

jgabry commented Apr 6, 2022

Yeah this sounds reasonable to me too.

@rok-cesnovar
Copy link
Member

Should be addressed in #643 :

Run below to test:

remotes::install_github("stan-dev/cmdstanr@cmdstan-variable-refactor")
Sys.setenv("CMDSTAN" = "/top/level/folder/of/cmdstan/installs") # or set it in .Renviron

library(cmdstanr)

@bwiernik
Copy link
Author

It seems to be working, but there is still a warning when the environment variable is set to a higher-level directory:

> Sys.setenv("CMDSTAN" = "~/cmdstanr")
> library(cmdstanr)
CmdStan path set to: /Users/brenton/cmdstanr/cmdstan-2.29.2
This is cmdstanr version 0.5.1
- CmdStanR documentation and vignettes: mc-stan.org/cmdstanr
- CmdStan path: /Users/brenton/cmdstanr/cmdstan-2.29.2
- CmdStan version: 2.29.2
Warning message:
Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants