Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to import module 'lambda_function': cannot import name 'WinDLL' from 'ctypes' (/var/lang/lib/python3.7/ctypes/__init__.py

I'm trying to generate a graph with matplotlib in python lambda function. i imported a layer with the library mathplotlib, but it doesn't work. The idea is generate a graph, save it like temp file and upload to S3.

When i run the code, the output is:

Response:
{
  "errorMessage": "Unable to import module 'lambda_function': cannot import name 'WinDLL' from 'ctypes' (/var/lang/lib/python3.7/ctypes/__init__.py)",
  "errorType": "Runtime.ImportModuleError"
}

Help!

I need intall another library? I saw that is a problem with numpy library, but i don't know.

Exist another library to generate graphs?

like image 538
Nicolas Parra Avatar asked Sep 30 '26 17:09

Nicolas Parra


1 Answers

I assume you used a windows OS to package your python libraries (via virtualenv) and uploaded them as a zip file in the create function section of AWS-Lambda.

AWS is linux based so the incompatibility might stem from the fact that you packaged your libraries on windows.

Basically, you would need to do the packaging in a linux machine. Maybe using a free tier version of ec2-linux. Moreover, the matplotlib library has it's own compatibility issues so there is no real guarantee that this approach will work.

Hope this helps

like image 143
The_Aron Avatar answered Oct 02 '26 09:10

The_Aron