cmdstanpy: Command "make build" failed in CmdStanInstall
Summary:
Cannot rebuild nor install cmdstan via cmdstanpy. CmdStan from Github compiles without issues.
Description:
Weird bug - cmdstan stopped working with:
INFO:cmdstanpy:compiling stan file /Users/jerzybaranowski/GitHub/KAIR-ISZ/isz/src/python/laboratoria/stan4.stan to exe file /Users/jerzybaranowski/GitHub/KAIR-ISZ/isz/src/python/laboratoria/stan4
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
I attempted rebuild_cmdstan()
Compiling: (01:06) | ████▉ | make: ** ... stansummary] Error 1
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File /opt/anaconda3/envs/DA2022/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/DA2022/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/jerzybaranowski/GitHub/KAIR-ISZ/isz/src/python/laboratoria/lab2a.ipynb Cell 29' in <module>
----> ]()[1]()[ rebuild_cmdstan()
File /opt/anaconda3/envs/DA2022/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/DA2022/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]()
install_cmdstan gave similar results
Installing CmdStan version: 2.29.1
Install directory: /Users/jerzybaranowski/.cmdstan
Downloading CmdStan version 2.29.1
Download successful, file: /var/folders/96/_4tl8xsx4tx9rj0ykk82715h0000gn/T/tmpyd5u5ghr
Extracting distribution
Unpacked download as cmdstan-2.29.1
Building version cmdstan-2.29.1, may take several minutes, depending on your system.
Command "make build" failed
Command ['make', 'build', '-j1']
error during processing No such file or directory
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:119, in build(verbose, progress, cores)
[118]()[ else:
--> ]()[119]()[ do_command(cmd, fd_out=None)
]()[121]()[ except RuntimeError as e:
]()[122]()[ # pylint: disable=raise-missing-from
File /opt/anaconda3/envs/DA2022/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)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:529, in main(args)
]()[528]()[ retrieve_version(version, progress)
--> ]()[529]()[ install_version(
]()[530]()[ cmdstan_version=cmdstan_version,
]()[531]()[ overwrite=args['overwrite'],
]()[532]()[ verbose=args['verbose'],
]()[533]()[ progress=progress,
]()[534]()[ cores=args['cores'],
]()[535]()[ )
]()[536]()[ except RuntimeError as e:
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:259, in install_version(cmdstan_version, overwrite, verbose, progress, cores)
]()[258]()[ print('Rebuilding version {}'.format(cmdstan_version))
--> ]()[259]()[ build(verbose, progress=progress, cores=cores)
]()[260]()[ print('Test model compilation')
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:123, in build(verbose, progress, cores)
]()[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)):
CmdStanInstallError: Command "make build" failed
Command ['make', 'build', '-j1']
error during processing No such file or directory
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
[... skipping hidden 1 frame]
/Users/jerzybaranowski/GitHub/KAIR-ISZ/isz/src/python/laboratoria/lab2a.ipynb Cell 30' in <module>
]()[1]()[ from cmdstanpy import install_cmdstan
----> ]()[2]()[ install_cmdstan()
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/utils.py:1303, in install_cmdstan(version, dir, overwrite, compiler, progress, verbose, cores)
]()[1301]()[ from .install_cmdstan import main
-> ]()[1303]()[ main(args)
]()[1304]()[ # pylint: disable=broad-except
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/cmdstanpy/install_cmdstan.py:538, in main(args)
]()[537]()[ print(e)
--> ]()[538]()[ sys.exit(3)
]()[539]()[ else:
SystemExit: 3
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
[... skipping hidden 1 frame]
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/interactiveshell.py:1927, in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
]()[1926]()[ def show_usage_error(self, exc):
-> ]()[1927]()[ """Show a short message for UsageErrors
]()[1928]()[
]()[1929]()[ These are special exceptions that shouldn't show a traceback.
]()[1930]()[ """
]()[1931]()[ print("UsageError: %s" % exc, file=sys.stderr)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:578, in ListTB.get_exception_only(self, etype, value)
]()[570]()[ def get_exception_only(self, etype, value):
]()[571]()[ """Only print the exception type and message, without a traceback.
]()[572]()[
]()[573]()[ Parameters
(...)
]()[576]()[ value : exception value
]()[577]()[ """
--> ]()[578]()[ return ListTB.structured_traceback(self, etype, value)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:436, in ListTB.structured_traceback(self, etype, evalue, etb, tb_offset, context)
]()[433]()[ chained_exc_ids.add(id(exception[1]))
]()[434]()[ chained_exceptions_tb_offset = 0
]()[435]()[ out_list = (
--> ]()[436]()[ self.structured_traceback(
]()[437]()[ etype, evalue, (etb, chained_exc_ids),
]()[438]()[ chained_exceptions_tb_offset, context)
]()[439]()[ + chained_exception_message
]()[440]()[ + out_list)
]()[442]()[ return out_list
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:1105, in AutoFormattedTB.structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
]()[1103]()[ else:
]()[1104]()[ self.tb = tb
-> ]()[1105]()[ return FormattedTB.structured_traceback(
]()[1106]()[ self, etype, value, tb, tb_offset, number_of_lines_of_context)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:999, in FormattedTB.structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
]()[996]()[ mode = self.mode
]()[997]()[ if mode in self.verbose_modes:
]()[998]()[ # Verbose modes need a full traceback
--> ]()[999]()[ return VerboseTB.structured_traceback(
]()[1000]()[ self, etype, value, tb, tb_offset, number_of_lines_of_context
]()[1001]()[ )
]()[1002]()[ elif mode == 'Minimal':
]()[1003]()[ return ListTB.get_exception_only(self, etype, value)
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:852, in VerboseTB.structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
]()[850]()[ """Return a nice text document describing the traceback."""
]()[851]()[ assert etb is not None
--> ]()[852]()[ formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
]()[853]()[ tb_offset)
]()[855]()[ colors = self.Colors # just a shorthand + quicker name lookup
]()[856]()[ colorsnormal = colors.Normal # used a lot
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:786, in VerboseTB.format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
]()[784]()[ assert isinstance(tb_offset, int)
]()[785]()[ head = self.prepare_header(etype, self.long_header)
--> ]()[786]()[ records = self.get_records(etb, number_of_lines_of_context, tb_offset)
]()[788]()[ frames = []
]()[789]()[ skipped = 0
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/IPython/core/ultratb.py:840, in VerboseTB.get_records(self, etb, number_of_lines_of_context, tb_offset)
]()[834]()[ options = stack_data.Options(
]()[835]()[ before=before,
]()[836]()[ after=after,
]()[837]()[ pygments_formatter=formatter,
]()[838]()[ )
]()[839]()[ assert etb is not None
--> ]()[840]()[ return list(stack_data.FrameInfo.stack_data(etb, options=options))[tb_offset:]
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/stack_data/core.py:546, in FrameInfo.stack_data(cls, frame_or_tb, options, collapse_repeated_frames)
]()[530]()[ @classmethod
]()[531]()[ def stack_data(
]()[532]()[ cls,
(...)
]()[536]()[ collapse_repeated_frames: bool = True
]()[537]()[ ) -> Iterator[Union['FrameInfo', RepeatedFrames]]:
]()[538]()[ """
]()[539]()[ An iterator of FrameInfo and RepeatedFrames objects representing
]()[540]()[ a full traceback or stack. Similar consecutive frames are collapsed into RepeatedFrames
(...)
]()[544]()[ and optionally an Options object to configure.
]()[545]()[ """
--> ]()[546]()[ stack = list(iter_stack(frame_or_tb))
]()[548]()[ # Reverse the stack from a frame so that it's in the same order
]()[549]()[ # as the order from a traceback, which is the order of a printed
]()[550]()[ # traceback when read top to bottom (most recent call last)
]()[551]()[ if is_frame(frame_or_tb):
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/stack_data/utils.py:98, in iter_stack(frame_or_tb)
]()[96]()[ while frame_or_tb:
]()[97]()[ yield frame_or_tb
---> ]()[98]()[ if is_frame(frame_or_tb):
]()[99]()[ frame_or_tb = frame_or_tb.f_back
]()[100]()[ else:
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/stack_data/utils.py:91, in is_frame(frame_or_tb)
]()[90]()[ def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool:
---> ]()[91]()[ assert_(isinstance(frame_or_tb, (types.FrameType, types.TracebackType)))
]()[92]()[ return isinstance(frame_or_tb, (types.FrameType,))
File /opt/anaconda3/envs/DA2022/lib/python3.10/site-packages/stack_data/utils.py:172, in assert_(condition, error)
]()[170]()[ if isinstance(error, str):
]()[171]()[ error = AssertionError(error)
--> ]()[172]() raise error
AssertionError:
cmdstan from sources compiles proprly but does not cooperate with cmdstanpy.
Additional Information:
Everything is on Mac OS Monterey 12.2.1 M1 mac mini.
Tried :
- reinstallation of xcode command line tools
- new conda environment
- reinstallation of cmdstanpy
- building cmdstan from sources
Current Version:
cmdstanpy-1.0.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (11 by maintainers)
Thanks! I’ve opened a tracking issue specific to the conda m1 installation here: https://github.com/conda-forge/cmdstan-feedstock/issues/28
Glad it was resolved. I’m going to close this issue for now and pursue some more changes to the conda setup
thanks! sounds like this should go into docs for troubleshooting installation.
Ok this is a workaround I managed to restore cmdstan operation:
It builds cmdstanpy but returns PCH error when compiling example model 5. Run
It completes successfully and everything works