开发者

undefined _PyUnicodeUCS4_IsWhitespace in compiled cython+numpy

i work on ubuntu 10.04 and used cython to compile my python code开发者_如何学Go. i then tried to copy 2 of my binaries (one with numpy, and one without) to another distribution with supported kernel and etc... the only thing i did which is not so cool is that i used the python that comes with that distribution (2.6), and copy from my ubuntu the numpy libraries.

when i exec the one without numpy, it works. when i exec the one with the 'from numpy import ...' i get an error like: undefined symbol: _PyUnicodeUCS4_IsWhitespace. i thought that the numpy just compiled for UCS4 where as the python version in the new dist is UCS2. but for my surprise, when i exec the same python code with the numpy import - as python and not compiled - it works.

so basically i can say that if i open 'python' and import numpy libraries it works and i can use them. but if i'm using the compiled version - i get that UCS4 error.. any ideas?

(the new dist is not so much in my control and i can't really just compile anything i want on that dist)

Thanks.


well, it goes like this:
when running python interpreter and imports the numpy library it tries to load from libpython.so the symbol Python is compiled with (i guess so). this is why it works with the interpreter. so the request for that unicode function doesn't come from numpy - but from Python - so it uses the UCS2 functions it compiled with (probably). but when running the compiled version, and again, it tries to load that function - it can't find it because it searches for a UCS4 version..

i did a small check: grep "_PyUnicode" in libpython, in the first dist, and in the second - and there was the different: one printed UCS4 functions, and the other printed UCS2 functions..

so the "easy" solution here i guess is to compile on my first dist a UCS2 version Python, then setting Cython to compile with UCS2.. i believe that will do the job.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜