本文介绍了pystan:distutils.errors.CompileError:命令"gcc"失败,退出状态为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 14.04.3和最新版本的anaconda.

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

当pystan尝试编译模型时,出现以下错误:

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

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

当我尝试在工作的RHEL服务器上运行模型时,一切正常.

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

在安装pystan之前,我已经运行

Before installing pystan, I ran

apt-get install build-essential

我尝试使用anaconda安装stan并从源代码构建,但仍然出现错误.

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.

完整的错误输出在下面

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

推荐答案

如果有人遇到相同的问题,请按照以下步骤解决问题

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

  1. 卸载Anaconda
  2. 安装Anaconda
  3. 使用pip安装pystan

不知道为什么行得通.

这篇关于pystan:distutils.errors.CompileError:命令"gcc"失败,退出状态为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 11:33