Undefined: PyUnicodeUCS2_Decode when trying to install psycopg2

I get an error when trying to install psycopg2 on ubuntu 9.10 64 bit.

Error:

>>> import psycopg2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "psycopg2/__init__.py", line 69, in <module> from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS2_Decode 

I tried to download the package from http://initd.org/pub/software/psycopg/ and install it. I also tried using easy_install.

Installation error.

This is rather strange since my python (2.6.2) was compiled with UCS4 and so the installation should work without problems.

Any help would be appreciated.

Greetings

+4
source share
2 answers

fixed it.

I had to recompile python using --enable-unicode = ucs4.

It’s still not clear why, since the default version on ubuntu uses ucs4.

+7
source

As you say, your Python was built by UCS4. But the psycopg2 you are trying to install was built against Python created by UCS2. Find one or build one against UCS4.

+4
source

Source: https://habr.com/ru/post/1306108/


All Articles