Skip to content

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!

asked 2 years ago2.7K views
1 Answer
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

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.