Someone is trying to use the conda install route on Windows. Does below error give a clue what might be the problem? I wonder if the environment is not activated or even if this is possible in this case.
The user is able to test the examples:
I just installed cmstan on a Windows 10 machine via conda, as recommended in the cmdstan user guide. The cmdstan home directory is then C:\Users\Jakob\Anaconda3\Library\bin\cmdstan, from which I were able to succesfully run the cmdstan examples.
Does the 60 in the last line refer to line 60 in the makefile?
ENV["JULIA_CMDSTAN_HOME"] = "C:\\Users\\Jakob\\Anaconda3\\Library\\bin\\cmdstan"
model = "
theta ~ beta(1,1);
y ~ bernoulli(theta);
sm = SampleModel("bernoulli", model, tempdir())
This results in the following Error:
Error when compiling SampleModel bernoulli:
/usr/bin/expr: missing operand
Try '/usr/bin/expr --help' for more information.
/usr/bin/rm: missing operand
Try '/usr/bin/rm --help' for more information.
make: *** [make/program:60: C:\Users\Jakob\AppData\Local\Temp\bernoulli.exe] Error 1```
If anyone, @WardBrian would know.
I believe the error refers to
$CMDSTAN/make/program (a makefile snippet we include in the top-level makefile) at line 60. I’ve never seen this particular error before. Has the user activated the conda environment? In addition to pointing Julia to the right place, they need all the other dependencies from that environment
Thanks, will try to install via conda on my machine to reproduce the steps needed.
Great! I’m not sure how many people have been using the conda installation alongside Julia, so it’s good to find any issues. I also found this Julia package which might do a better job of making sure all the binaries are found, if that ends up being the problem
Ah, that looks very promising! I’ll have a go at it and report back with progress over the next couple of days. Thanks for your help!
Hi @WardBrian & @rok_cesnovar
After going back and forth a bit, the conda install route works fine now.
Once you come to this point:
(stan-env) rob@Rob-16-MBP bernoulli % conda list cmdstan
# packages in environment at /Users/rob/opt/miniconda3/envs/stan-env:
# Name Version Build Channel
cmdstan 2.28.2 h8783527_0 conda-forge
and point the environment variable (in the Julia case) correct (shown below):
(stan-env) rob@Rob-16-MBP bernoulli % echo $JULIA_CMDSTAN_HOME
(stan-env) rob@Rob-16-MBP bernoulli % cd $JULIA_CMDSTAN_HOME
(stan-env) rob@Rob-16-MBP cmdstan % pwd
(stan-env) rob@Rob-16-MBP cmdstan % make examples/bernoulli/bernoulli
make: 'examples/bernoulli/bernoulli' is up to date.
(stan-env) rob@Rob-16-MBP cmdstan % cd examples/bernoulli
(stan-env) rob@Rob-16-MBP bernoulli % ./bernoulli sample data file=bernoulli.data.json
method = sample (Default)
num_samples = 1000 (Default)
num_warmup = 1000 (Default)
save_warmup = 0 (Default)
thin = 1 (Default)
Works! Both on Windows & MacOS Monterey. Very impressive work!!!
On my M1 I’ll stick with using/building the sources although I see no real reason why it wouldn’t work as long as I would use conda-forge for M1.
May the text in the installation docs can be updated?
The conda installation is designed so one can use the R, Python or Julia bindings to CmdStan seamlessly.
The “seamlessly” quote is because the Conda installation sets
$CMDSTAN (Which both cmdstanr and cmdstanpy) look for. I’d want to set the Julia env (or encourage the Julia packages to use the same as the others) before claiming it’s truly seamless, but I’m very glad to hear it works!
That’s a good idea. I’ll look into it.
Done, either CMDSTAN or JULIA_CMDSTAN_HOME can now be used as environment variables.
Of course only JULIA_CMDSTAN_HOME would show up in
ENV["CMDSTAN"] will quickly show the value.
Interesting history: CMDSTAN_HOME (2011) → JULIA_CMDSTAN_HOME (~2019) → CMDSTAN (almost 2022).
Too much on my plate right now, but it would be interesting if Conda.jl would allow me to test “JuliaStan packages on Windows” in GitHub CI workflow!