[Python] Pydantic vs. Python 3.13.0: No module named 'typing_extensions'

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I have code that worked fine with Python 3.10.12 and Pydantic 2.7.3.

    I read that Pydantic ^2.8 supports Python 3.13.

    The same code, and indeed even just import pydantic under a Python 3.13.0 shell with Pydantic 2.10.2, however, gives:

    File "/home/user/path-to-package/src/validator.py", line 9, in <module>
    from pydantic import TypeAdapter, BaseModel, validator
    File "/home/user/path-to-package/.venv/lib/python3.13/site-packages/pydantic/__init__.py", line 396, in <module>
    _getattr_migration = getattr_migration(__name__)
    File "/home/user/path-to-package/.venv/lib/python3.13/site-packages/pydantic/_migration.py", line 260, in getattr_migration
    from .errors import PydanticImportError
    File "/home/user/path-to-package/.venv/lib/python3.13/site-packages/pydantic/errors.py", line 7, in <module>
    from typing_extensions import Literal, Self
    ModuleNotFoundError: No module named 'typing_extensions'



    Why?

    How can I fix this?

    Continue reading...

Compartilhe esta Página