在RHEL中导入statsmodel失败,带有未定义的符号:PyUnicodeUCS4_DecodeUTF8

问题描述 投票:0回答:1

我在RHEL上安装了statsmodels及其所有依赖项。导入statsmodels时,它给了我:

(,ImportError('/ home / lib / python2.7 / site-packages / statsmodels / tsa / kalmanf / kalman_loglike.so:undefined symbol:PyUnicodeUCS4_DecodeUTF8',))

看看其他页面,我重新编译了python 2.7.15(我有),UCS-4作为unicode表示。但是,numpy抱怨它正在寻找UCS-2!因此,statsmodels需要UCS-4,但它的依赖性numpy需要UCS-2。

有什么建议吗?我实际上是在过去一周的努力中挣扎。看起来像statsmodels中的一个错误,但它适用于Windows上的Anaconda。所以,它只出现在RHEL机器上。

statsmodels
1个回答
0
投票

在python-dev中更新pyconfig-64.h包括如下:

/* Define as the size of the unicode type. */
//#define Py_UNICODE_SIZE 4
#define Py_UNICODE_SIZE 2

我发现unicodeobject.h:

/* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is
   properly set, but the default rules below doesn't set it.  I'll
   sort this out some other day -- [email protected] */

在python-dev中对齐这些文件以反映UCS2,为UCS2重新编译python,并在statsmodels中更新大约17个不同的.c文件,如:

//  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4) (PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS2)(PyUnicode_AS_UNICODE(u)[i]))

我终于成功地导入了statsmodels以及numpy。

我认为这需要在python和statsmodels中修复。

© www.soinside.com 2019 - 2024. All rights reserved.