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

Cannot load library pangocairo-1.0 when trying to get WeasyPrint working on AWS Lambda #401

Closed
NoneMan opened this issue Dec 13, 2016 · 9 comments
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered

Comments

@NoneMan
Copy link

NoneMan commented Dec 13, 2016

I like WeasyPrint, and I try to get it working on AWS Lambda. To meet the dependencies, I copied libpango-1.0.so and libpangocairo-1.0.so from Amazon Linux environment, and zipped them with my scirpts. But I got an error message when deploying:

module initialization error: cannot load library pangocairo-1.0: pangocairo-1.0: cannot open shared object file: No such file or directory

And I find this:

#lib/weasyprint/text.py
pango = dlopen(ffi, 'pango-1.0', 'libpango-1.0-0', 'libpango-1.0.so',
               'libpango-1.0.dylib')
pangocairo = dlopen(ffi, 'pangocairo-1.0', 'libpangocairo-1.0-0',
                    'libpangocairo-1.0.so', 'libpangocairo-1.0.dylib')
  • Why it can find libpango-1.0.so but cannot find libpangocairo-1.0.so ?
  • Is there a way to use WeasyPrint on AWS Lambda ?
@liZe liZe added bug Existing features not working as expected crash Problems preventing documents from being rendered labels Dec 14, 2016
@liZe
Copy link
Member

liZe commented Dec 14, 2016

Thanks for reporting!

Why it can find libpango-1.0.so but cannot find libpangocairo-1.0.so ?

I really don't know how AWS works, I'm afraid I won't be really helpful 😢. But a reason could be that:

  • pango is already installed on your system while pangocairo is not,
  • the name used to find pango (let's say it's libpango-1.0-0) is wrong for pangocairo (libpangocairo-1.0-0 instead of something like libpangocairo-1.0-1), and other names that work on other systems don't work on AWS.

Is there a way to use WeasyPrint on AWS Lambda ?

I don't know… @sparrovv is using EC2 in #223, maybe it could help to contact him.

@liZe
Copy link
Member

liZe commented Mar 25, 2017

@NoneMan can I close this issue?

@polakala
Copy link

I am seeing the same problem when creating aws lambda function for weasyprint. Did anyone resolved this?

@y0rd4nis
Copy link

I'm running WeasyPrint on AWS Lambda, the first run of my lambda function fails because it does not find some pango libs, I copied libpango-1.0.so.0.2800.1, libpangocairo-1.0.so.0.2800.1 and libpangoft2-1.0.so.0.2800.1 from Amazon Linux to the root of my lambda function package, I renamed the firt two .so to pango-1.0 and pangocairo-1.0 and now it is working.

I have had some problems with gif images that can be seen in #428 and my comment.

@liZe
Copy link
Member

liZe commented Jun 15, 2017

Is anyone interested in adding an "AWS" section to the documentation?

@liZe
Copy link
Member

liZe commented Nov 19, 2017

Closing. See #428 about images and documentation.

@liZe liZe closed this as completed Nov 19, 2017
@Prasengupta
Copy link

Prasengupta commented Nov 21, 2017

Guys below is the git link where you can download the weasy print library which works with AWS lambda.

https://github.com/Prasengupta/weasyprint_for_awslambda

These libraries are picked from Amazon Linux is equal to centOS. which may not working in your local windows machine but works in aws lambda function for sure
Please raise a ticket if you face any issues.

@procal
Copy link

procal commented Jul 22, 2019

Thanks for the lambda support @Prasengupta @liZe . I've tried uploading my WEasyPrint lambda function with your package directory @Prasengupta but I'm still getting an import error. I've also tried my own zip of packages from pip and imported the3 pango files directly from an Amazon Linux instance (they're still using pango-1.28.1 anyway) but without any success.

Removed the WEasyPrint import and execution of the lambda function is fine. I'm out of ideas now unfortunately. Can you tell me how you pulled that zip file together originally? Were they all pulled from Amazon Linux?

Thanks so much,
Ed

@Prasengupta
Copy link

Hi @procal

I think you're trying to execute in python3 which the published package is not supported. Please check with python27

I've searched those files in the amazon Linux instance by the command and able to get them. But I don't remember the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected crash Problems preventing documents from being rendered
Projects
None yet
Development

No branches or pull requests

6 participants