python : undefined symbol: PyUnicodeUCS2_DecodeUTF8
You are using a different Python interpreter for running your code than the one used to compile scipy. This usually occurs with a Python installation compiled with Unicode UCS2 support running modules compiled against a Python installation with Unicode UCS4 support (or vis versa). You need to recompile/reinstall the scipy installation with exact the Python interpreter used for running your code.
trying to import a module: undefined symbol: PyUnicodeUCS4_DecodeUTF8
The module was built against a Python that was built with UCS-4 as its internal unicode
representation. Your Python was built with UCS-2 as its internal representation. Rebuild the module, or rebuild Python.
This issue is mentioned in the official FAQ. This is discussed in-depth in python issue 8654.
undefined symbol: PyUnicodeUCS2_Decode whilst trying to install psycopg2
fixed it.
I had to recompile python with --enable-unicode=ucs4.
Still not clear why as the default version on ubuntu uses ucs4.
Python: ImportError: /usr/local/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyUnicodeUCS2_Replace
You have (at least) two different versions of Python installed and you're mixing their files. Make sure that $PYTHONPATH
, $PYTHONHOME
and sys.path
only contain folders for a single Python installation. In your case, one installation is in /usr/local
and the other is probably in /usr
.
Also, you can try installing virtualenvwrapper
and setting up separate python environment to alleviate any conflicts you might be having. Here is a tutorial for installing and using virtualenv.
Have C Start Python Interpreter under a USC-2
There is no way to initialize the interpreter with the correct encoding. Whether the interpreter uses UCS2 or UCS4 is a compile-time choice. What you need to do is to recompile the entire module from source. If you do not have the sources for the module, then you must compile the Python 2.7 from source and be careful to not replace the system python 2.7 with it.
The UCS2 builds were considered a mistake because there the non-BMP characters will be represented as UTF-16 surrogate pairs that now become visible as separate codepoints. That is why Python 3 does not have this compile-time option, as it always uses UCS4 internally for strings that cannot be represented in UCS2.
Related Topics
Boolean Operators VS Bitwise Operators
Pandas Read_SQL With Parameters
Equivalent to Gettickcount() on Linux
How to Import the Class Within the Same Directory or Sub Directory
Get Last N Lines of a File, Similar to Tail
How to Use CSS Selectors to Retrieve Specific Links Lying in Some Class Using Beautifulsoup
Environment Variables When Script Run by Cron
How to Install Python on Alpine Linux
Plotting the Data with Scrollable X (Time/Horizontal) Axis on Linux
Better Way to Script Usb Device Mount in Linux
Send Sigint in Python to Os.System
Python:Undefined Symbol: Pyunicodeucs2_Decodeutf8
How to See Pip Package Sizes Installed
Python Parsing Log File to Extract Events in Real Time
How to Return a Value from a Shell Script in a Python Script