I have the same problem that @jbaranowski described, so I followed these steps:
- checked with mentioned “conda search” command for availability of build
- created new env
- installed cmdstanpy via conda
Creating model failed with output:
INFO:cmdstanpy:compiling stan file /Users/adrian/Documents/LAB4/tes.stan to exe file /Users/adrian/Documents/LAB4/tes
WARNING:cmdstanpy:CmdStan's precompiled header (PCH) files may need to be rebuilt.If your model failed to compile please run cmdstanpy.rebuild_cmdstan().
If the issue persists please open a bug report
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/Users/adrian/Documents/LAB4/testgp.ipynb Cell 4' in <cell line: 1>()
----> 1 model = CmdStanModel(stan_file='tes.stan')
File ~/opt/anaconda3/envs/cmdstan/lib/python3.10/site-packages/cmdstanpy/model.py:210, in CmdStanModel.__init__(self, model_name, stan_file, exe_file, compile, stanc_options, cpp_options, user_header)
208 self.compile(force=str(compile).lower() == 'force')
209 if self._exe_file is None:
--> 210 raise ValueError(
211 'Unable to compile Stan model file: {}.'.format(
212 self._stan_file
213 )
214 )
ValueError: Unable to compile Stan model file: /Users/adrian/Documents/LAB4/tes.stan.
As suggested I tried to rebuild, but it also failed:
Compiling: (01:09) | ████▉ | make: ** ... stansummary] Error 1
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File ~/opt/anaconda3/envs/cmdstan/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:117, in build(verbose, progress, cores)
116 progress_hook: Any = _wrap_build_progress_hook()
--> 117 do_command(cmd, fd_out=None, pbar=progress_hook)
118 else:
File ~/opt/anaconda3/envs/cmdstan/lib/python3.10/site-packages/cmdstanpy/utils.py:1089, in do_command(cmd, cwd, fd_out, pbar)
1086 msg = 'Command {}\n\t{} {}'.format(
1087 cmd, returncode_msg(proc.returncode), serror
1088 )
-> 1089 raise RuntimeError(msg)
1090 except OSError as e:
RuntimeError: Command ['make', 'build', '-j1']
error during processing No such file or directory
During handling of the above exception, another exception occurred:
CmdStanInstallError Traceback (most recent call last)
/Users/adrian/Documents/LAB4/testgp.ipynb Cell 3' in <cell line: 2>()
1 from cmdstanpy import rebuild_cmdstan
----> 2 rebuild_cmdstan()
File ~/opt/anaconda3/envs/cmdstan/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:223, in rebuild_cmdstan(verbose, progress, cores)
221 with pushd(cmdstan_path()):
222 clean_all(verbose)
--> 223 build(verbose, progress, cores)
224 compile_example(verbose)
225 except ValueError as e:
File ~/opt/anaconda3/envs/cmdstan/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:123, in build(verbose, progress, cores)
119 do_command(cmd, fd_out=None)
121 except RuntimeError as e:
122 # pylint: disable=raise-missing-from
--> 123 raise CmdStanInstallError(f'Command "make build" failed\n{str(e)}')
124 if not os.path.exists(os.path.join('bin', 'stansummary' + EXTENSION)):
125 raise CmdStanInstallError(
126 f'bin/stansummary{EXTENSION} not found'
127 ', please rebuild or report a bug!'
128 )
CmdStanInstallError: Command "make build" failed
Command ['make', 'build', '-j1']
error during processing No such file or directory
So it seems that there is still an issue somewhere in conda version or maybe I am doing something wrong