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.
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.
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.
AWS Lambda issue with psycopg2
I ran into this issue as well when trying to upload the .zip containing my Lambda. The issue for me was that I was compressing my Lambda from one directory above.
The solution was running the zip command within the directory containing the Lambda function itself as opposed to running zip from its parent directory.
For example, if your lambda function exists within the directory ~/lambda as lambda_function.py along with any additional libraries (i.e. multiprocessing) - you should zip your Lambda Deployment Package by doing the following.
$ cd ~/lambda
$ zip lambda_function.zip lambda_function.py
$ zip -r lambda_function.zip multiprocessing*
Uploading the resulting .zip file should resolve this issue.
Related Topics
How to Create a Namespace Package in Python
How to Use Python2.7 Pip Instead of Default Pip
Pil Installation Fails Missing:Stdarg.H
Weighted Random Selection with and Without Replacement
Python Selenium Click on Button
Get List from Pandas Dataframe Column or Row
Reading File Using Relative Path in Python Project
Difference Between Exit() and Sys.Exit() in Python
How to Access the Query String in Flask Routes
How to Automatically Install Required Packages from a Python Script as Necessary
Extract Text from Xml Documents in Python
Priority of the Logical Operators Not, And, or in Python
How to Get Different Colored Lines for Different Plots in a Single Figure
How to Construct a Timedelta Object from a Simple String
Passing Functions with Arguments to Another Function in Python