Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Thu Apr 11, 2024 8:32 am

I am trying to test a Python Lambda Function which takes an Excel file from s3 and returns all the images bytes. It is working fine when I am running it locally. But when I am running it in the lambda console with test input it throws a runtime error.

Error -

INIT_REPORT Init Duration: 10042.52 ms Phase: init Status: timeout
START RequestId: 60e08380-f0d0-416a-90aa-b1554103895f Version: $LATEST
[INFO] 2024-04-11T07:28:44.433Z 60e08380-f0d0-416a-90aa-b1554103895f Found credentials in environment variables.
**Creating temp file**
**Temp file created**
Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively, you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see aka.ms/dotnet-missing-libicu for more information.
RequestId: 60e08380-f0d0-416a-90aa-b1554103895f Error: Runtime exited with error: signal: aborted
Runtime.ExitError
END RequestId: 60e08380-f0d0-416a-90aa-b1554103895f
REPORT RequestId: 60e08380-f0d0-416a-90aa-b1554103895f Duration: 1892.88 ms Billed Duration: 1893 ms Memory Size: 4096 MB Max Memory Used: 222 MB


The code is very straightforward:
Code: Select all
from spire.xls import *
    print("Creating temp file")
    with tempfile.NamedTemporaryFile(suffix=".xlsx", delete=True) as temp_file:
        temp_file.write(file_path)

        # Get the file name
        temp_file_name = temp_file.name
    print("Temp file created")
   
    workbook = Workbook()


It is very clear from the log error that it failed to create an instance of the Workbook class and threw the "Couldn't find a valid ICU package" error.

I am using Python image in the docker file and Windows to create and push the code

animesh7370
 
Posts: 3
Joined: Wed Apr 10, 2024 2:23 pm

Thu Apr 11, 2024 9:25 am

Hi,

Thanks for your inquiry.
According to the exception information (Couldn't find a valid ICU package installed on the system), this reason of your issue may be that the Spire.Xls package isn’t put to the Python image. In addition, if the platform is Linux, you need to use the linux version of Spire.Xls for Python. For example, you can download our latest version of Spire.Xls for Python 14.2.2 through our web site, then unzip the file, you will find the linux version, as shown in the following screenshot.
linux version.png
linux version.png (15.57 KiB) Viewed 5512 times


Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Fri Apr 12, 2024 7:37 pm

I am installing it properly and I am using this "Spire.Xls-14.2.2-py3-none-manylinux1_x86_64.whl " one. And because I am not getting any issues in import statement it mean it is installed properly.

animesh7370
 
Posts: 3
Joined: Wed Apr 10, 2024 2:23 pm

Mon Apr 15, 2024 9:22 am

Hi,

Thanks for your feedback.
According to the exception you provided, it seems that you need to install libicu on your runtime environment. If your runtime environment is Ubuntu, you can use the following code:

Code: Select all
sudo apt-get update
 sudo apt-get install libicu-dev



Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Mon Apr 15, 2024 9:31 am

AWS Lambda runs on Amazon Linux but run time env in my case is Python as my program is in python

animesh7370
 
Posts: 3
Joined: Wed Apr 10, 2024 2:23 pm

Tue Apr 16, 2024 6:41 am

Hi,

You can try the solution I provided in my last reply, then give me feedback. Thanks in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.XLS