Skip to content

No CmdStan installation found #81

@jolespin

Description

@jolespin

I installed v0.1.0 via the following:

conda install -c conda-forge biom-format patsy xarray arviz cmdstanpy
pip install birdman

When I try to run a negative binomial model, I get the following error:

INFO:cmdstanpy:No CmdStan installation found.
INFO:cmdstanpy:Cannot determine whether version is before 2.27.
INFO:cmdstanpy:No CmdStan installation found.
INFO:cmdstanpy:Cannot determine whether version is before 2.29.
INFO:cmdstanpy:compiling stan file /Users/jespinoz/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/birdman/templates/negative_binomial.stan to exe file /Users/jespinoz/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/birdman/templates/negative_binomial
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [8], in <module>
      3 biom_iris = biom.Table(X_iris.values.T,   X_iris.columns, X_iris.index)#, sample_metadata=y_iris.to_frame())
      5 nb = NegativeBinomial(
      6     table=biom_iris,
      7     formula="species",
      8     metadata=y_iris.to_frame("species"),
      9     num_iter=1000,
     10 )
---> 11 nb.compile_model()
     12 nb.fit_model()

File ~/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/birdman/model_base.py:86, in BaseModel.compile_model(self)
     84 def compile_model(self):
     85     """Compile Stan model."""
---> 86     self.sm = CmdStanModel(stan_file=self.model_path)

File ~/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/cmdstanpy/model.py:213, in CmdStanModel.__init__(self, model_name, stan_file, exe_file, compile, stanc_options, cpp_options, user_header)
    210         get_logger().debug("TBB already found in load path")
    212 if compile and self._exe_file is None:
--> 213     self.compile(force=str(compile).lower() == 'force')
    214     if self._exe_file is None:
    215         raise ValueError(
    216             'Unable to compile Stan model file: {}.'.format(
    217                 self._stan_file
    218             )
    219         )

File ~/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/cmdstanpy/model.py:419, in CmdStanModel.compile(self, force, stanc_options, cpp_options, user_header, override_options)
    417 sout = io.StringIO()
    418 try:
--> 419     do_command(cmd=cmd, cwd=cmdstan_path(), fd_out=sout)
    420 except RuntimeError as e:
    421     sout.write(f'\n{str(e)}\n')

File ~/anaconda3/envs/soothsayer_p3.9_env/lib/python3.9/site-packages/cmdstanpy/utils.py:163, in cmdstan_path()
    161 cmdstan_dir = os.path.expanduser(os.path.join('~', _DOT_CMDSTAN))
    162 if not os.path.exists(cmdstan_dir):
--> 163     raise ValueError(
    164         'No CmdStan installation found, run "install_cmdstan" or'
    165         ' (re)activate your conda environment!'
    166     )
    167 latest_cmdstan = get_latest_cmdstan(cmdstan_dir)
    168 if latest_cmdstan is None:

ValueError: No CmdStan installation found, run "install_cmdstan" or (re)activate your conda environment!

I tried installing cmdstan via conda but it says that it's already installed.

Here's the executable I found:

(soothsayer_p3.9_env) jespinozlt2-osx:~ jespinoz$ which cmdstan_model
/Users/jespinoz/anaconda3/envs/soothsayer_p3.9_env/bin/cmdstan_model

I then tried running your install_cmdstan command but it needs an argument.

(soothsayer_p3.9_env) jespinozlt2-osx:~ jespinoz$ install_cmdstan
Traceback (most recent call last):
  File "/Users/jespinoz/anaconda3/envs/soothsayer_p3.9_env/bin/install_cmdstan", line 10, in <module>
    sys.exit(main())
TypeError: main() missing 1 required positional argument: 'args'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions