google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.63k stars 324 forks source link

Can't install latest grpc with generative-ai-python #505

Closed tebeka closed 3 months ago

tebeka commented 3 months ago

Description of the feature request:

I'd like to bump the dependency of google-ai-generativelanguage so it'll use later grpc and protobuf versions.

What problem are you trying to solve with this feature?

I have the following dependencies:

grpcio ~= 1.65
grpcio-reflection ~= 1.65
google-generativeai ~= 0.7

Pip can't install due to:

ERROR: Cannot install google-generativeai and runner because these package versions have conflicting dependencies.

The conflict is caused by:
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.4 depends on protobuf<6.0dev and >=5.26.1
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.2 depends on protobuf<6.0dev and >=5.26.1
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.1 depends on protobuf<6.0dev and >=5.26.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Any other information you'd like to share?

I see that https://github.com/googleapis/google-cloud-python/blob/main/packages/google-ai-generativelanguage/setup.py has newer version as dependencies.

singhniraj08 commented 3 months ago

@tebeka,google-generativeai 0.7.2 will support latest grpcio 1.65.4. Please install the latest google-generativeai to work with grpc latest release. Thank you! Ref: image

tebeka commented 3 months ago

Thanks! I'll check it out.

On Tue, 13 Aug 2024, 08:14 Niraj Singh, @.***> wrote:

@tebeka https://github.com/tebeka,google-generativeai 0.7.2 will support latest grpcio 1.65.4. Please install the latest google-generativeai to work with grpc latest release. Thank you! Ref: image.png (view on web) https://github.com/user-attachments/assets/961fc4b1-27a2-4acc-ad3c-b774e17e69cc

— Reply to this email directly, view it on GitHub https://github.com/google-gemini/generative-ai-python/issues/505#issuecomment-2285353834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAVNEN7KUW2GHKV63HHZM3ZRGIZVAVCNFSM6AAAAABMKRXUS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOBVGM2TGOBTGQ . You are receiving this because you were mentioned.Message ID: @.***>

tebeka commented 3 months ago

My bad, it the grpcio-reflection that causes the issue:

The following requirements.txt fails:

google-generativeai ~= 0.7
grpcio ~= 1.65
grpcio-reflection ~= 1.65
$ ./venv/bin/python -m pip install -r requirements.txt
Collecting grpcio~=1.65 (from -r requirements.txt (line 1))
  Using cached grpcio-1.65.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.3 kB)
Collecting google-generativeai~=0.7 (from -r requirements.txt (line 2))
  Using cached google_generativeai-0.7.2-py3-none-any.whl.metadata (4.0 kB)
Collecting grpcio-reflection~=1.65 (from -r requirements.txt (line 3))
  Using cached grpcio_reflection-1.65.4-py3-none-any.whl.metadata (1.1 kB)
Collecting google-ai-generativelanguage==0.6.6 (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached google_ai_generativelanguage-0.6.6-py3-none-any.whl.metadata (5.6 kB)
Collecting google-api-core (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached google_api_core-2.19.1-py3-none-any.whl.metadata (2.7 kB)
Collecting google-api-python-client (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached google_api_python_client-2.140.0-py2.py3-none-any.whl.metadata (6.7 kB)
Collecting google-auth>=2.15.0 (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached google_auth-2.33.0-py2.py3-none-any.whl.metadata (4.7 kB)
Collecting protobuf (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached protobuf-5.27.3-cp38-abi3-manylinux2014_x86_64.whl.metadata (592 bytes)
Collecting pydantic (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached pydantic-2.8.2-py3-none-any.whl.metadata (125 kB)
Collecting tqdm (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached tqdm-4.66.5-py3-none-any.whl.metadata (57 kB)
Collecting typing-extensions (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Collecting proto-plus<2.0.0dev,>=1.22.3 (from google-ai-generativelanguage==0.6.6->google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached proto_plus-1.24.0-py3-none-any.whl.metadata (2.2 kB)
Collecting protobuf (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached protobuf-4.25.4-cp37-abi3-manylinux2014_x86_64.whl.metadata (541 bytes)
INFO: pip is looking at multiple versions of grpcio-reflection to determine which version is compatible with other requirements. This could take a while.
Collecting grpcio-reflection~=1.65 (from -r requirements.txt (line 3))
  Using cached grpcio_reflection-1.65.2-py3-none-any.whl.metadata (1.1 kB)
  Using cached grpcio_reflection-1.65.1-py3-none-any.whl.metadata (1.1 kB)
Collecting google-generativeai~=0.7 (from -r requirements.txt (line 2))
  Using cached google_generativeai-0.7.1-py3-none-any.whl.metadata (3.9 kB)
  Using cached google_generativeai-0.7.0-py3-none-any.whl.metadata (3.9 kB)
Collecting google-ai-generativelanguage==0.6.5 (from google-generativeai~=0.7->-r requirements.txt (line 2))
  Using cached google_ai_generativelanguage-0.6.5-py3-none-any.whl.metadata (5.6 kB)
INFO: pip is still looking at multiple versions of grpcio-reflection to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r requirements.txt (line 2), -r requirements.txt (line 3) and google-generativeai because these package versions have conflicting dependencies.

The conflict is caused by:
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.4 depends on protobuf<6.0dev and >=5.26.1
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.2 depends on protobuf<6.0dev and >=5.26.1
    google-generativeai 0.7.0 depends on protobuf
    google-ai-generativelanguage 0.6.5 depends on protobuf!=3.20.0, !=3.20.1, !=4.21.0, !=4.21.1, !=4.21.2, !=4.21.3, !=4.21.4, !=4.21.5, <5.0.0dev and >=3.19.5
    grpcio-reflection 1.65.1 depends on protobuf<6.0dev and >=5.26.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: python -m pip install --upgrade pip
Gunand3043 commented 3 months ago

@tebeka, Kindly downgrade grpcio-reflection to version 1.31 and proceed with the installation using the latest versions of google-generativeai 0.7.2 and grpcio 1.65.5. Thank you! Ref: image

tebeka commented 3 months ago

Thanks! Closing.