I got some errors when I run below pystan code.
import pystan
import matplotlib.pyplot as plt
import numpy as np
OneVar_code = """
data {
int<lower=0> J;
real y[J];
}
parameters {
real<lower=-1000, upper=1000> mu;
real<lower=0, upper=1000> sigma;
}
transformed parameters {
}
model {
y ~ normal(mu, sigma);
}
"""
LData = [ 44, 44, 56, 59, 44, 44, 63, 60, 34, 58,
55, 50, 32, 61, 47, 25, 38, 47, 30, 42]
OneVar_dat = { 'J' : len(LData), 'y': LData }
sm = pystan.StanModel(model_code=OneVar_code)
fit = sm.sampling(data=OneVar_dat, iter=5000, chains=4, n_jobs=1)
print(fit)
Here is some errors I got.
DistutilsExecError Traceback (most recent call last)
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/unixccompiler.py:185, in UnixCCompiler._compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
184 try:
--> 185 self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
186 except DistutilsExecError as msg:
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/ccompiler.py:1041, in CCompiler.spawn(self, cmd, **kwargs)
1040 def spawn(self, cmd, **kwargs):
-> 1041 spawn(cmd, dry_run=self.dry_run, **kwargs)
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/spawn.py:70, in spawn(cmd, search_path, verbose, dry_run, env)
69 cmd = cmd[0]
---> 70 raise DistutilsExecError(
71 "command {!r} failed with exit code {}".format(cmd, exitcode)
72 )
DistutilsExecError: command '/Users/username/opt/anaconda3/envs/testenviroment/bin/x86_64-apple-darwin13.4.0-clang' failed with exit code 254
During handling of the above exception, another exception occurred:
CompileError Traceback (most recent call last)
Cell In[7], line 40
35 LData = [ 44, 44, 56, 59, 44, 44, 63, 60, 34, 58,
36
37 55, 50, 32, 61, 47, 25, 38, 47, 30, 42]
39 OneVar_dat = { 'J' : len(LData), 'y': LData }
---> 40 sm = pystan.StanModel(model_code=OneVar_code)
41 fit = sm.sampling(data=OneVar_dat, iter=5000, chains=4, n_jobs=1)
42 print(fit)
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/pystan/model.py:378, in StanModel.__init__(self, file, charset, model_name, model_code, stanc_ret, include_paths, boost_lib, eigen_lib, verbose, obfuscate_model_name, extra_compile_args, allow_undefined, include_dirs, includes)
375 orig_stderr = pystan.misc._redirect_stderr()
377 try:
--> 378 build_extension.run()
379 finally:
380 if redirect_stderr:
381 # restore stderr
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py:345, in build_ext.run(self)
342 self.compiler.set_link_objects(self.link_objects)
344 # Now actually compile and link everything.
--> 345 self.build_extensions()
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py:467, in build_ext.build_extensions(self)
465 self._build_extensions_parallel()
466 else:
--> 467 self._build_extensions_serial()
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py:493, in build_ext._build_extensions_serial(self)
491 for ext in self.extensions:
492 with self._filter_build_errors(ext):
--> 493 self.build_extension(ext)
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py:548, in build_ext.build_extension(self, ext)
545 for undef in ext.undef_macros:
546 macros.append((undef,))
--> 548 objects = self.compiler.compile(
549 sources,
550 output_dir=self.build_temp,
551 macros=macros,
552 include_dirs=ext.include_dirs,
553 debug=self.debug,
554 extra_postargs=extra_args,
555 depends=ext.depends,
556 )
558 # XXX outdated variable, kept here in case third-part code
559 # needs it.
560 self._built_objects = objects[:]
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/ccompiler.py:600, in CCompiler.compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends)
598 except KeyError:
599 continue
--> 600 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
602 # Return *all* object filenames, not just the ones we just built.
603 return objects
File ~/opt/anaconda3/envs/testenviroment/lib/python3.8/site-packages/setuptools/_distutils/unixccompiler.py:187, in UnixCCompiler._compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
185 self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
186 except DistutilsExecError as msg:
--> 187 raise CompileError(msg)
CompileError: command '/Users/username/opt/anaconda3/envs/testenviroment/bin/x86_64-apple-darwin13.4.0-clang' failed with exit code 254
My python and other module or package are latest.
If you have some solutions for this, could you let me know? Thanks in advance.