Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import module 'pdf2image_demo': cannot import name '_imaging' #8

Open
Marcin-Duszynski opened this issue Oct 8, 2019 · 9 comments
Assignees

Comments

@Marcin-Duszynski
Copy link

Hi,

After deploying it to the AWS Lambda using your sh script I got the error:

Unable to import module 'pdf2image_demo': cannot import name '_imaging'

What could cause it?

@Belval
Copy link
Owner

Belval commented Oct 8, 2019

IIRC it's an issue with Pillow, when the package is installed for pdf2image if the environment already has Pillow installed, the Pillow dependency sometimes end up in a broken state.

I'll do some tests on my side.

@Belval
Copy link
Owner

Belval commented Oct 8, 2019

I was able to reproduce the issue on master with a clean OS.

@Belval
Copy link
Owner

Belval commented Oct 8, 2019

Found the issue (and I am a little disappointed that I didn't think about it sooner). Pillow is a compiled cython module which means that it depends on having matching python versions.

Archlinux (and you OS I assume) now ship with 3.7 as default which his not compatible with the 3.6 interpreter used by AWS lambda.

I don't have a fix for now, I simply installed python 3.6 and built the package with that. Maybe the whole thing could be built in the docker container.

@Marcin-Duszynski
Copy link
Author

I was using your master version without any changes. It means that it was compiled/build using ubuntu:18.04 docker image.

@Belval
Copy link
Owner

Belval commented Oct 8, 2019

The issue is unrelated to docker, you simply have to use python 3.6 when running the script.

@mahak7
Copy link

mahak7 commented Sep 15, 2020

Hi Belval, Thanks for this. It will be really helpful for many of us. But Is there a chance you can try the step by step guide to use docker and run this service on AWS Lambda. Since, many of us are not much experienced with Docker, having those steps would be really really helpful. Thanks in advance!

@Belval
Copy link
Owner

Belval commented Sep 15, 2020

Sure I can try to write a small how-to. I'll see to it this week.

@Belval Belval self-assigned this Sep 15, 2020
@mahak7
Copy link

mahak7 commented Sep 17, 2020

Awesome, will look forward to it

@criskgl
Copy link

criskgl commented Mar 12, 2021

Belval bro cmon... We having a bit of trouble here. I can pay in NFTs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants