Saltar al contenido

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!

preguntada hace 2 años2,8 mil visualizaciones
1 Respuesta
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

EXPERTO
respondido hace 2 años
EXPERTO
revisado hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.