# Problem building the case study in https://github.com/bob-carpenter/stan-getting-started

**URL:** <https://discourse.mc-stan.org/t/problem-building-the-case-study-in-https-github-com-bob-carpenter-stan-getting-started/37316>\
**Category:** CmdStan\
**Created:** [November 20, 2024, 4:30am UTC](https://discourse.mc-stan.org/t/problem-building-the-case-study-in-https-github-com-bob-carpenter-stan-getting-started/37316 "2024-11-20T04:30:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsieg](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rsieg](https://discourse.mc-stan.org/u/rsieg)\
**Post date:** [November 20, 2024, 4:30am UTC](https://discourse.mc-stan.org/t/problem-building-the-case-study-in-https-github-com-bob-carpenter-stan-getting-started/37316/1 "2024-11-20T04:30:32Z")

</div>

Short summary of the problem:  
An error occurs when trying to build HTML or PDF examples, either with make or manually with Quarto.

1. List item

```no-highlight
code_to_run_your_model(if_applicable):

bob@dana:~/stan-getting-started$ make

quarto render quarto/stan-getting-started.qmd --to html --no-execute-daemon

Starting python3 kernel...Done

Executing 'stan-getting-started.quarto_ipynb'
  Cell 1/52: ''...Done
  Cell 2/52: ''...

An error occurred while executing the following cell:
------------------
N = 100
theta = 0.3
data = {'N': N, 'theta': theta}
model = csp.CmdStanModel(stan_file = '../stan/binomial-rng.stan')
sample = model.sample(data = data, seed = 123, chains = 1,
                      iter_sampling = 10, iter_warmup = 0,
                      show_progress = False, show_console = False)
------------------

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[2], line 5
      3 data = {'N': N, 'theta': theta}
      4 model = csp.CmdStanModel(stan_file = '../stan/binomial-rng.stan')
----> 5 sample = model.sample(data = data, seed = 123, chains = 1,
      6 iter_sampling = 10, iter_warmup = 0,
      7 show_progress = False, show_console = False)

File ~/.local/lib/python3.13/site-packages/cmdstanpy/model.py:1039, in CmdStanModel.sample(self, data, chains, parallel_chains, threads_per_chain, seed, chain_ids, inits, iter_warmup, iter_sampling, save_warmup, thin, max_treedepth, metric, step_size, adapt_engaged, adapt_delta, adapt_init_phase, adapt_metric_window, adapt_step_size, fixed_param, output_dir, sig_figs, save_latent_dynamics, save_profile, show_progress, show_console, refresh, time_fmt, timeout, force_one_process_per_chain)
   1036 else:
   1037 cmdstan_inits = _inits
-> 1039 args = CmdStanArgs(
   1040 self._name,
   1041 self._exe_file,
   1042 chain_ids=chain_ids,
   1043 data=_data,
   1044 seed=seed,
   1045 inits=cmdstan_inits,
   1046 output_dir=output_dir,
   1047 sig_figs=sig_figs,
   1048 save_latent_dynamics=save_latent_dynamics,
   1049 save_profile=save_profile,
   1050 method_args=sampler_args,
   1051 refresh=refresh,
   1052 )
   1054 if show_console:
   1055 show_progress = False

File ~/.local/lib/python3.13/site-packages/cmdstanpy/cmdstan_args.py:797, in CmdStanArgs. __init__ (self, model_name, model_exe, chain_ids, method_args, data, seed, inits, output_dir, sig_figs, save_latent_dynamics, save_profile, refresh)
    793 else:
    794 raise ValueError(
    795 'Unsupported method args type: {}'.format(type(method_args))
    796 )
--> 797 self.method_args.validate(len(chain_ids) if chain_ids else None)
    798 self.validate()

File ~/.local/lib/python3.13/site-packages/cmdstanpy/cmdstan_args.py:143, in SamplerArgs.validate(self, chains)
    138 raise ValueError(
    139 'Value for iter_warmup must be a non-negative integer,'
    140 ' found {}.'.format(self.iter_warmup)
    141 )
    142 if self.iter_warmup == 0 and self.adapt_engaged:
--> 143 raise ValueError(
    144 'Must specify iter_warmup > 0 when adapt_engaged=True.'
    145 )
    146 if self.iter_sampling is not None:
    147 if self.iter_sampling < 0 or not isinstance(
    148 self.iter_sampling, (int, np.integer)
    149 ):

ValueError: Must specify iter_warmup > 0 when adapt_engaged=True.

make: *** [makefile:2: quarto/stan-getting-started.html] Error 1

```

If possible, add also code to simulate data or attach a (subset of) the dataset you work with.

Please provide this additional information in addition to your question:

- Operating System: Fedora 41
- CmdStan Version: cmdstan-2.35.0
- Compiler/Toolkit: gcc 14.2.1

Looking forward to your topic!

---

<div class="post-metadata">

**Author:** ![mitzimorris](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/mitzimorris/32/29_2.png) [@mitzimorris](https://discourse.mc-stan.org/u/mitzimorris)\
**Post date:** [December 2, 2024, 2:57pm UTC](https://discourse.mc-stan.org/t/problem-building-the-case-study-in-https-github-com-bob-carpenter-stan-getting-started/37316/2 "2024-12-02T14:57:22Z")

</div>

what version of CmdStanPy are you using?

I think this might be related to this bug: [`iter_warmpup=0` and `fixed_param=True` will always fail for stan 2.34.1 · Issue #766 · stan-dev/cmdstanpy · GitHub](https://github.com/stan-dev/cmdstanpy/issues/766)

if you have the patience to play around with latest versions, could you please try the latest CmdStanPy and the latest 2.36 release candidate (new one coming this week).

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [December 3, 2024, 6:16am UTC](https://discourse.mc-stan.org/t/problem-building-the-case-study-in-https-github-com-bob-carpenter-stan-getting-started/37316/3 "2024-12-03T06:16:07Z")

</div>

Thanks—is there a way I can just update the case study and make this more robust?
