pystan: distutils.errors.CompileError: command 'gcc' failed with exit status 1

折月煮酒 提交于 2019-12-12 18:36:30

问题


I'm using Ubuntu 14.04.3 and latest version of anaconda.

When pystan tries to compile models, I get the following error:

distutils.errors.CompileError: command 'gcc' failed with exit status 1

When I try running the models on my RHEL server at work, everything works fine.

Before installing pystan, I ran

apt-get install build-essential

I've tried installing stan using anaconda and building from source, and I still get the error.

I have no idea what to try next.

Edit: Full error output is below

INFO:pystan:COMPILING THE C++ CODE FOR MODEL anon_model_900950b5a4d15a106db93874d106a01d NOW.
Traceback (most recent call last):
  File "schools.py", line 63, in <module>
    main()
  File "schools.py", line 59, in main
    output = fit()
  File "schools.py", line 54, in fit
    res = pystan.stan(model_code=pasted_code(), data=model_data, iter=1000, chains=4)
  File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/api.py", line 373, in stan
    save_dso=save_dso, verbose=verbose)
  File "/home/hahdawg/anaconda/lib/python2.7/site-packages/pystan/model.py", line 319, in __init__
    build_extension.run()
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 337, in run
    self.build_extensions()
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 446, in build_extensions
    self.build_extension(ext)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/command/build_ext.py", line 496, in build_extension
    depends=ext.depends)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/hahdawg/anaconda/lib/python2.7/distutils/unixccompiler.py", line 122, in _compile
    raise CompileError, msg
distutils.errors.CompileError: command 'gcc' failed with exit status 1

回答1:


In case anyone has the same issue, the following steps fixed the problem

  1. Uninstall Anaconda
  2. Install Anaconda
  3. Install pystan using pip

No idea why that worked.



来源:https://stackoverflow.com/questions/32783755/pystan-distutils-errors-compileerror-command-gcc-failed-with-exit-status-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!