pydantic / pydantic

Data validation using Python type hints
https://docs.pydantic.dev
MIT License
21.09k stars 1.9k forks source link

error importing pydantic using poetry in fastapi #4923

Closed jorgelopez08 closed 1 year ago

jorgelopez08 commented 1 year ago

Initial Checks

Description

When running a fastapi project using poetry, shows an error displaying:

ImportError: dlopen(/Users/jorgelopez/Library/Caches/pypoetry/virtualenvs/jlo-blog-qkDVX_54-py3.9/lib/python3.9/site-packages/pydantic/init.cpython-39-darwin.so, 0x0002): tried: '/Users/jorgelopez/Library/Caches/pypoetry/virtualenvs/jlo-blog-qkDVX_54-py3.9/lib/python3.9/site-packages/pydantic/init.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/jorgelopez/Library/Caches/pypoetry/virtualenvs/jlo-blog-qkDVX_54-py3.9/lib/python3.9/site-packages/pydantic/init.cpython-39-darwin.so' (no such file), '/Users/jorgelopez/Library/Caches/pypoetry/virtualenvs/jlo-blog-qkDVX_54-py3.9/lib/python3.9/site-packages/pydantic/init.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Example Code

No response

Python, Pydantic & OS Version

1.10.4

Affected Components

samuelcolvin commented 1 year ago

Read the error message - somehow you've installed the wrong binary.