Cannot import GeminiClient #7

Closed
opened 2026-02-13 17:27:38 -06:00 by mirrors · 2 comments
Owner

Originally created by @versatile712 on GitHub (Mar 20, 2024).

encouter error when executing from gemini_webapi import GeminiClient

My python version is Python 3.9.13, attached is the error message:

[~\AppData\Local\Temp\ipykernel_25048\4184372175.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Local/Temp/ipykernel_25048/4184372175.py) in <module>
      1 import asyncio
----> 2 from gemini_webapi import GeminiClient
      3 
      4 # # Replace "COOKIE VALUE HERE" with your actual cookie values.
      5 # # Leave Secure_1PSIDTS empty if it's not available for your account.

[~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\__init__.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/__init__.py) in <module>
----> 1 from .client import GeminiClient, ChatSession  # noqa: F401
      2 from .exceptions import *  # noqa: F401, F403
      3 from .types import *  # noqa: F401, F403
      4 from .utils import set_log_level  # noqa: F401

[~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\client.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/client.py) in <module>
      7 from httpx import AsyncClient, ReadTimeout
      8 
----> 9 from .types import WebImage, GeneratedImage, Candidate, ModelOutput
     10 from .exceptions import AuthError, APIError, TimeoutError, GeminiError
     11 from .constants import Endpoint, Headers

[~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\types\__init__.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/types/__init__.py) in <module>
----> 1 from .image import Image, WebImage, GeneratedImage  # noqa: F401
      2 from .candidate import Candidate  # noqa: F401
...
----> 8 async def upload_file(file: bytes | str, proxies: dict | None = None) -> str:
      9     """
     10     Upload a file to Google's server and return its identifier.

TypeError: unsupported operand type(s) for |: 'type' and 'type'```
Originally created by @versatile712 on GitHub (Mar 20, 2024). encouter error when executing `from gemini_webapi import GeminiClient` My python version is Python 3.9.13, attached is the error message: ```TypeError Traceback (most recent call last) [~\AppData\Local\Temp\ipykernel_25048\4184372175.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Local/Temp/ipykernel_25048/4184372175.py) in <module> 1 import asyncio ----> 2 from gemini_webapi import GeminiClient 3 4 # # Replace "COOKIE VALUE HERE" with your actual cookie values. 5 # # Leave Secure_1PSIDTS empty if it's not available for your account. [~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\__init__.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/__init__.py) in <module> ----> 1 from .client import GeminiClient, ChatSession # noqa: F401 2 from .exceptions import * # noqa: F401, F403 3 from .types import * # noqa: F401, F403 4 from .utils import set_log_level # noqa: F401 [~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\client.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/client.py) in <module> 7 from httpx import AsyncClient, ReadTimeout 8 ----> 9 from .types import WebImage, GeneratedImage, Candidate, ModelOutput 10 from .exceptions import AuthError, APIError, TimeoutError, GeminiError 11 from .constants import Endpoint, Headers [~\AppData\Roaming\Python\Python39\site-packages\gemini_webapi\types\__init__.py](https://file+.vscode-resource.vscode-cdn.net/d%3A/OneDrive/MyFiles/Research/Projects/CIO%20Gender%202010-2020/Data%20Process/Dependent%20Variables/ITMW/~/AppData/Roaming/Python/Python39/site-packages/gemini_webapi/types/__init__.py) in <module> ----> 1 from .image import Image, WebImage, GeneratedImage # noqa: F401 2 from .candidate import Candidate # noqa: F401 ... ----> 8 async def upload_file(file: bytes | str, proxies: dict | None = None) -> str: 9 """ 10 Upload a file to Google's server and return its identifier. TypeError: unsupported operand type(s) for |: 'type' and 'type'```
mirrors 2026-02-13 17:27:38 -06:00
Author
Owner

@versatile712 commented on GitHub (Mar 20, 2024):

solved, it requrires python>=3.10, rather than python 3.8 shown in the homepage

@versatile712 commented on GitHub (Mar 20, 2024): solved, it requrires python>=3.10, rather than python 3.8 shown in the homepage
Author
Owner

@HanaokaYuzu commented on GitHub (Mar 20, 2024):

Thanks for the feedback. Will update the package info soon.

@HanaokaYuzu commented on GitHub (Mar 20, 2024): Thanks for the feedback. Will update the package info soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mirrors/Gemini-API#7
No description provided.