Aspose - excel to pdf, excel to image, excel to html in python

@NehaPawar,

The error indicates that Aspose.Cells for Python via .NET might rely on .NET globalization features, specifically ICU (International Components for Unicode), which are not available in your minimal AWS Lambda environment.

Could you please enable Invariant Globalization Mode it works fine. You can configure your Lambda function to run .NET in Invariant Mode by setting an environment variable, e.g., in your AWS Lambda configuration:

DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true

You may also bundle the ICU libraries in your deployment package and ensure .NET can find them.

Hi @amjad.sahi

Yeah we tried to set this flag to true - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true in the code itself at the start.
After that, was able to read the excel file but then encountered an error while saving it as PDF using aspose on this line:
workbook.save(pdf_bytes, pdfSaveOptions)

Error after using DOTNET_SYSTEM_GLOBALIZATION_INVARIANT - just for the reference:
[ERROR] RuntimeError: Proxy error(CellsException): The type initializer for ‘’ threw an exception.
Traceback (most recent call last):
File “/var/task/VBCSwiftReportsGenerator.py”, line 113, in lambda_handler
workbook.save(pdf_bytes, pdfSaveOptions)


And our code is in python and deployed on lambda, so do you have any idea on how to bundle the ICU libraries in this scenario?

@NehaPawar,

It’s good to hear that you’re able to read the Excel file successfully. When Aspose.Cells saves as PDF, it utilizes system fonts, globalization features (ICU), and GDI+/Skia rendering, which may require native .so libraries. Since you’re working with Lambda + Python rather than a Docker container, you might consider the following steps to try:

  1. Manually download and include ICU libraries.
  2. Update the LD_LIBRARY_PATH environment variable.
  3. Add fontconfig and relevant fonts for proper PDF rendering.

We’ll further review the specifics and may follow up with additional details.

@NehaPawar
Based on your first error message, “Couldn’t find a valid ICU package…”, we believe that you still need to install the appropriate ICU version in your environment. Although setting "DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true" can be used in scenarios where ICU is definitely not required, the garbled characters in your second error (‘’) suggest that ICU is indeed needed.

Therefore, you should install a specific version of ICU — note that it must be lower than version 71. You can refer to the example of installing ICU in Docker and the Note section in the Docs for more details.