Error - Couldn't find a valid ICU package installed on the system

I’m a beginner, just trying to get started on using the aspose.words library for python, but I’ve hit an immediate roadblock. I used pip install aspose-words which appears to work. However, when trying to run the test script exactly as seen in the product page, I get the following error:

Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_CurrentCulture()
   at System.Globalization.NumberFormatInfo.get_CurrentInfo()
   at System.Guid.TryParseExactD(System.ReadOnlySpan`1<Char>, GuidResult ByRef)
   at System.Guid.TryParseGuid(System.ReadOnlySpan`1<Char>, GuidResult ByRef)
   at System.Guid.TryParse(System.ReadOnlySpan`1<Char>, System.Guid ByRef)
   at System.Diagnostics.Tracing.EventSource.GetGuid(System.Type)
   at System.Diagnostics.Tracing.EventSource..ctor(System.Diagnostics.Tracing.EventSourceSettings, System.String[])
   at System.Diagnostics.Tracing.EventSource..ctor()
   at System.Collections.Concurrent.CDSCollectionETWBCLProvider..cctor()
   at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].AcquireAllLocks(Int32 ByRef)
   at System.Collections.Concurrent.ConcurrentDictionary`2[[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].get_Count()
   at hBb.j(Int32, Boolean)
   at hBb.i(Int32)
   at Hf..ctor(Int32)
   at Hf..ctor()
   at Hf..ctor(Boolean)
   at Aspose.Words.Properties.BuiltInDocumentProperties..cctor()
   at Aspose.Words.Properties.BuiltInDocumentProperties..ctor()
   at Aspose.Words.Document..ctor(dZ)
   at Aspose.Words.Document..ctor()
   at WrpNs_Aspose.WrpNs_Words.WrpCs_Document_44597C31.ctor_000_Document()
Aborted (core dumped)

The error appears to happen as soon as aw.Document() is called for the first time.

My os is linux (Kubuntu 22.10).

Any idea where I can start fixing this issue?

@OliverG Please see our documentation to learn about additional requirements of Aspose.Words in Linux:
https://docs.aspose.com/words/python-net/system-requirements/#system-requirements-for-target-linux-platform

Also, it might be required to install libicu-dev package. Here is working Dockerfile configuration on Ubountu:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND="noninteractive"

RUN apt-get update -y
RUN apt-get install -y python3-pip
RUN apt-get install -y libpython3.7
RUN apt-get install -y pkg-config libicu-dev

WORKDIR /usr/app/src

# Copy function code
COPY app.py ./

RUN  pip install aspose-words

CMD [ "python3", "app.py"]

I have already installed it,But it still doesn’t work:

(doc) root@114-016:~# apt-get install -y pkg-config libicu-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
pkg-config is already the newest version (1.8.1-1).
libicu-dev is already the newest version (72.1-3).
The following package was automatically installed and is no longer required:
  linux-image-6.1.0-18-amd64
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 86 not upgraded.

error:

Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
   at System.Globalization.GlobalizationMode..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.StringComparer..cctor()
   at System.StringComparer.get_OrdinalIgnoreCase()
   at Xg.d(System.String)
   at Cg.s(System.String)
   at Cg.A(System.String, System.String, Boolean)
   at Cg.I(System.String, System.String)
   at Aspose.Words.Properties.BuiltInDocumentProperties..cctor()
   at Aspose.Words.Properties.BuiltInDocumentProperties..ctor()
   at Aspose.Words.Document..ctor(rw)
   at Aspose.Words.Document..ctor()
   at WrpNs_Aspose.WrpNs_Words.WrpCs_Document_44597C31.ctor_000_Document()
Aborted

@hunter01s Could you please provide information about your environment? We will try to recreate it on our side and test the scenario.

My environment is as follows:
Linux version 6.1.0-28-amd64 (debian-kernel@lists.debian.org) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22)

in addition,
python version:

Python 3.12.8 | packaged by Anaconda, Inc.

.NET Core Runtime version:

aspnetcore-runtime-7.0 is already the newest version (7.0.20-1).

@hunter01s Thank you for additional information. libicu does not work properly on Debian. To make it work it is required to install libicu66 after libicu. Please see Dockerfile for Debian on our github:
https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET/blob/master/Dockerfile
You can find it at the end of the file.

Also, you can try installing an older version of ICU:

RUN wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu70_70.1-2_amd64.deb
RUN dpkg -i libicu70_70.1-2_amd64.deb

Thank you very much. According to your solution, the problem has been successfully resolved.

1 Like