DSX Python import error : undefined symbol: PyUnicodeUCS2_AsUTF8String

こ雲淡風輕ζ 提交于 2020-01-04 05:35:23

问题


On IBM DSX, I have a spark service instance on which I have installed a few newer versions of packages such as numpy.

I am facing an issue with the import of numpy. The following code:

import numpy

raises this error message:

ImportError: /gpfs/fs01/user/USERID/.local/lib/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: PyUnicodeUCS2_AsUTF8String

The import used to work.


回答1:


This is because of a mismatch in the Unicode characters representation between Python that you are using and the package you are importing. Solution is to use the extension modules compiled with a Python binary built using the same size for Unicode characters. You can update the Python2 packages installed in IBM Data Science Expereince Notebooks by:

!pip freeze --user > requirements.txt
!while read p; do pip install --user "${p}" --ignore-installed ; done <./requirements.txt

Restart the notebook kernel as a precaution.



来源:https://stackoverflow.com/questions/45355711/dsx-python-import-error-undefined-symbol-pyunicodeucs2-asutf8string

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