[Python] ImportError: Cannot import name 'get_default_text_client' from...

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering an ImportError after upgrading the google-generativeai library. The error is: ImportError: cannot import name 'get_default_text_client' from 'google.generativeai.client' (/path/to/my/site-packages/google/generativeai/client.py) # Replace with your actual path!

    I'm using Python [3.10] and installed the library using pip install --upgrade google-generativeai.

    Here's a minimal code example that reproduces the error: Python

    import os from google.generativeai import text

    os.environ["GOOGLE_API_KEY"] = "xyz"

    I'm not sure what's causing this issue. Any help would be greatly appreciated!

    I have tried the following:

    • Upgrading google-generativeai using pip install --upgrade google-generativeai.
    • Uninstalling and reinstalling google-generativeai: pip uninstall google-generativeai followed by pip install google-generativeai.
    • Restarting my Jupyter kernel/Python interpreter.

    Continue reading...

Compartilhe esta Página