Salta al contenuto

How to solve pydantic_core error?

0

I installed various libraries, including the pydantic library(pip install pydantic), in pycharm, created a zip file, and then added it to the lambda layer. But ERROR: Could not find a version that satisfies the requirement pydantic_core._pydantic_core (from versions: none) ERROR: No matching distribution found for pydantic_core._pydantic_core The above error was generated. Please help me!

posta 2 anni fa2795 visualizzazioni
1 Risposta
0

Hi,

Lambda requires packages built for a specific architecture. Many packages have distributions for multiple architectures (see https://pypi.org/project/pydantic-core/#files for pydantic-core). By default, pip installs the distribution suitable for the machine where you are running it on, which is not necessary the same architecture as your Lambda.

But you can force pip to install packages for the architecture you want. If your Lambda uses x86_64, then you should select platform manylinux2014_x86_64:

pip install pydantic-core --platform manylinux2014_x86_64 -t . --only-binary=:all:

-t . - means install in the current directory.

However, the best way is to install all your dependencies with the required platform, rather than doing it for each package.

pip install -r requirements.txt --platform manylinux2014_x86_64 --target ./python -

Credit to this answer: https://stackoverflow.com/questions/77210131/can-i-force-pip-to-install-dependencies-for-x86-64-architecture-in-powershell-to/77210143#77210143

Best,

Didier

ESPERTO
con risposta 2 anni fa
ESPERTO
verificato 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.