[Python] Version dependency conflicts when adding langchain-google-genai to poetry project

Discussão em 'Python' iniciado por Stack, Agosto 28, 2025.

  1. Stack

    Stack Membro Participativo

    I am adding the langchain-google-genai library to my project but poetry indicates it needs a higher pydantic version than the one I have, which conflicts with the pydantic version required the fastapi version of the project. How can I solve this?

    poetry add langchain_google_genai

    Using version ^1.0.7 for langchain-google-genai

    Updating dependencies
    Resolving dependencies... (30.6s)

    Because no versions of langchain-core match >0.2.9,<0.2.10 || >0.2.10,<0.3
    and langchain-core (0.2.9) depends on pydantic (>=2.7.4,<3.0.0), langchain-core (>=0.2.9,<0.2.10 || >0.2.10,<0.3) requires pydantic (>=2.7.4,<3.0.0).
    And because langchain-core (0.2.10) depends on pydantic (>=2.7.4,<3.0.0), langchain-core (>=0.2.9,<0.3) requires pydantic (>=2.7.4,<3.0.0).
    Because no versions of langchain-google-genai match >1.0.7,<2.0.0
    and langchain-google-genai (1.0.7) depends on langchain-core (>=0.2.9,<0.3), langchain-google-genai (>=1.0.7,<2.0.0) requires langchain-core (>=0.2.9,<0.3).
    (1) Thus, langchain-google-genai (>=1.0.7,<2.0.0) requires pydantic (>=2.7.4,<3.0.0).

    Because no versions of fastapi match >0.96.0,<0.96.1 || >0.96.1,<0.97.0
    and fastapi (0.96.0) depends on pydantic (>=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0), fastapi (>=0.96.0,<0.96.1 || >0.96.1,<0.97.0) requires pydantic (>=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0).
    And because fastapi (0.96.1) depends on pydantic (>=1.7.4,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0), fastapi (>=0.96.0,<0.97.0) requires pydantic (>=1.6.2,<1.7 || >1.7,<1.7.1 || >1.7.1,<1.7.2 || >1.7.2,<1.7.3 || >1.7.3,<1.8 || >1.8,<1.8.1 || >1.8.1,<2.0.0).
    And because langchain-google-genai (>=1.0.7,<2.0.0) requires pydantic (>=2.7.4,<3.0.0) (1), langchain-google-genai (>=1.0.7,<2.0.0) is incompatible with fastapi (>=0.96.0,<0.97.0)
    So, because persualia-langserve depends on both fastapi (^0.96.0) and langchain-google-genai (^1.0.7), version solving failed.


    I tried updating the fastapi version, trying to have one that matches the required version of pydantic by langchain-google-genai, but it broke my existing code.

    Continue reading...

Compartilhe esta Página