【发布时间】:2014-06-14 03:22:56
【问题描述】:
如果我这样做 sudo pip3 install statsmodels 我会出错。我在下面粘贴了控制台输出的末尾。我看到一个 numpy 1.7 警告,但如果我这样做 pip3 freeze | grep numpy,我发现我正在使用 numpy==1.8.1。
这是输出。有什么想法吗?
/usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
statsmodels/tsa/kalmanf/kalman_loglike.c: In function ‘__Pyx_TraceSetupAndCall’:
statsmodels/tsa/kalmanf/kalman_loglike.c:7021:17: error: ‘PyFrameObject’ has no member named ‘f_tstate’
(*frame)->f_tstate = PyThreadState_GET();
^
In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ndarrayobject.h:26:0,
from /usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from statsmodels/tsa/kalmanf/kalman_loglike.c:257:
statsmodels/tsa/kalmanf/kalman_loglike.c: At top level:
/usr/lib/python3/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1629:1: warning: ‘_import_array’ defined but not used [-Wunused-function]
_import_array(void)
^
In file included from /usr/lib/python3/dist-packages/numpy/core/include/numpy/ufuncobject.h:327:0,
from statsmodels/tsa/kalmanf/kalman_loglike.c:258:
/usr/lib/python3/dist-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]
_import_umath(void)
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/statsmodels/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ukof84o0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/statsmodels
Storing debug log for failure in /home/kurt/.pip/pip.log
【问题讨论】:
-
我的意思是,从该输出来看,他们的 C 代码扩展中似乎存在错误。
-
哪个python 3? python 3.4 需要最新的 cython 版本,你需要重建 statsmodels 中的所有 cython 扩展。 python 3.2 和 3.3 应该可以正常工作,并且已经可以正常工作很长时间了。下一个 statsmodels 版本将支持 python 3.4。
-
这就是我解决问题的方法。我在 python 3.4 附带的 Ubuntu 14.04 上。我做了
find -name '*.pyx'来查找每个 Cython 文件并在每个文件上运行cython3 -a(只有 3 个文件)。