pemistahl / lingua-py

The most accurate natural language detection library for Python, suitable for short text and mixed-language text
Apache License 2.0
1.08k stars 44 forks source link

No module named 'regex._regex' #142

Closed krakatorange closed 1 year ago

krakatorange commented 1 year ago

When deploying as a Layer to AWS Lambda and running a test, I receive this error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'regex._regex'

Runtime: python3.9 Architecture: x86_64

I tried with regex version 2022.10.31 and with latest version 2023.3.23 as well. All runs normally on local machine running 3.9.

pemistahl commented 1 year ago

Hi @krakatorange, I'm afraid you are asking the wrong person here. This is most probably a problem with the regex package itself. My library does not do any fancy stuff with this dependency, it just imports it. So please ask the maintainers of the regex package. Thank you.

krakatorange commented 1 year ago

To make this package work in AWS Lambda I downloaded the specific package below and zipped as a Lambda Layer (Lingua requires regex 2022.10.31):

https://files.pythonhosted.org/packages/de/82/1e868572aaa6b5468f07512fd184650bf9ade15943d4f1ae83d0dc512872/regex-2022.10.31-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

This fixed my issue.