Hi, I am new to pystan, an error occurs when I compile a model. It gives two kinds of error. I have tried looking at other threads that addressed this, but all the recommendations I have tried hasn't worked:
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
distutils.errors.CompileError: command 'gcc' failed with exit status 1
Description:
I am running this in a Python 3 environment.
Reproducible Steps:
import pystan
schools_code = """
data {
int J; // number of schools
real y[J]; // estimated treatment effects
real sigma[J]; // s.e. of effect estimates
}
parameters {
real mu;
real tau;
real eta[J];
}
transformed parameters {
real theta[J];
for (j in 1:J)
theta[j] = mu + tau * eta[j];
}
model {
eta ~ normal(0, 1);
y ~ normal(theta, sigma);
}
"""
sm = pystan.StanModel(model_code=schools_code)
fit = sm.sampling(data=schools_dat, iter=1000, chains=4)
print(fit)
eta = fit.extract(permuted=True)['eta']
np.mean(eta, axis=0)
Current Output:
The current output. Knowing what is the current behavior is useful.
INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_0fe254f3c524d4153537de9712f3f235 NOW.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
extra_postargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
spawn(cmd, dry_run=self.dry_run)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/gideonidumah/Desktop/Internship/msgi_2020_gideon/hodgkinhuxley_inversion/Stan.py", line 29, in
sm = pystan.StanModel(model_code=schools_code)
File "/Users/gideonidumah/Desktop/Internship/msgi_2020_gideon/sir_inversion_python/env/lib/python3.7/site-packages/pystan/model.py", line 378, in init
build_extension.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1
Process finished with exit code 1
Expected Output:
Describe what you expect the output to be. Knowing the correct behavior is also very useful.
Summary:
Hi, I am new to pystan, an error occurs when I compile a model. It gives two kinds of error. I have tried looking at other threads that addressed this, but all the recommendations I have tried hasn't worked:
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1 distutils.errors.CompileError: command 'gcc' failed with exit status 1
Description:
I am running this in a Python 3 environment.
Reproducible Steps:
import pystan schools_code = """ data { int J; // number of schools
real y[J]; // estimated treatment effects
real sigma[J]; // s.e. of effect estimates
}
parameters {
real mu;
real tau;
real eta[J];
}
transformed parameters {
real theta[J];
for (j in 1:J)
theta[j] = mu + tau * eta[j];
}
model {
eta ~ normal(0, 1);
y ~ normal(theta, sigma);
}
"""
schools_dat = {'J': 8, 'y': [28, 8, -3, 7, -1, 1, 18, 12], 'sigma': [15, 10, 16, 11, 9, 11, 10, 18]}
sm = pystan.StanModel(model_code=schools_code) fit = sm.sampling(data=schools_dat, iter=1000, chains=4)
print(fit)
eta = fit.extract(permuted=True)['eta'] np.mean(eta, axis=0)
Current Output:
The current output. Knowing what is the current behavior is useful. INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_0fe254f3c524d4153537de9712f3f235 NOW. Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile extra_postargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py", line 909, in spawn spawn(cmd, dry_run=self.dry_run) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py", line 36, in spawn _spawn_posix(cmd, search_path, dry_run=dry_run) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix % (cmd, exit_status)) distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/Users/gideonidumah/Desktop/Internship/msgi_2020_gideon/hodgkinhuxley_inversion/Stan.py", line 29, in
sm = pystan.StanModel(model_code=schools_code)
File "/Users/gideonidumah/Desktop/Internship/msgi_2020_gideon/sir_inversion_python/env/lib/python3.7/site-packages/pystan/model.py", line 378, in init
build_extension.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/ccompiler.py", line 574, in compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1
Process finished with exit code 1
Expected Output:
Describe what you expect the output to be. Knowing the correct behavior is also very useful.
PyStan Version:
Python Version:
Operating System:
Mac OS Catalina Version 10.15.5