Skip to content Skip to sidebar Skip to footer

Import Error: Ephem/_libastro.so Undefined Symbol: Pyunicodeucs2_asutf8string

I just successfully installed PyEphem using pip in a pyenv. However, on import I receive: ImportError: /python2.7/site-packages/ephem/_libastro.so: undefined symbol: PyUnicodeUCS2

Solution 1:

The symbol PyUnicode_AsUTF8String(value) is used once in _libastro.c and is defined on my system in the file:

/usr/include/python2.7/unicodeobject.h

There it can be aliased one of two ways:

#ifndef Py_UNICODE_WIDE# ...# define PyUnicode_AsUTF8String PyUnicodeUCS2_AsUTF8String# ...#else# ...# define PyUnicode_AsUTF8String PyUnicodeUCS4_AsUTF8String

Your error message makes it sound as though your system Python is compiled to use 4-byte-wide Unicode strings (hence why the linker cannot find a UCS2 version of this function inside of it), but that the version of PyEphem that auto-compiled on your system when you ran pip install somehow got confused and unset Py_UNICODE_WIDE and thus generated C code that was expected a UCS2 symbol.

Do you have several compiled versions of Python on your system, where the Unicode setting of one version could accidentally be affecting how this compile for your system Python takes place?

Post a Comment for "Import Error: Ephem/_libastro.so Undefined Symbol: Pyunicodeucs2_asutf8string"