Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pillow a full dependency #62

Closed
wants to merge 1 commit into from
Closed

Conversation

Mukamik
Copy link

@Mukamik Mukamik commented Mar 14, 2024

Issue:

Pillow is listed as a package.extra, even though it seems to be explicitly depended upon even when passing images as base64 instead of PIL images.
This seems to happen because the functions that support image formats other than PIL still convert the other formats to PIL during the process (_convert_to_parts, _load_image_from_gcs, etc)

Proposal:

Convert pillow to a full dependency.

Relevant lines:

https://github.com/langchain-ai/langchain-google/blob/main/libs/genai/langchain_google_genai/chat_models.py#L209-L261

Error message:

File "/usr/local/lib/python3.12/site-packages/langchain_google_genai/chat_models.py", line 234, in _url_to_pil
  raise ImportError(
ImportError: PIL is required to load images. Please install it with `pip install pillow`

@lkuligin
Copy link
Collaborator

I'm not sure we want to keep PIL as a required dependency.
Have you tried to install the package with pip install langchain-google-genai[images]?

P.S. We should probably adjust the error message though. Would you be open to send a PR for that, please?

@AmgadHasan
Copy link

Yes, I think we should keep PIL as an optional dependency. It is a big package and can result in unnecessarily large file sizes.

The error message should be improved though

@lkuligin
Copy link
Collaborator

it looks to be stale, closing

@lkuligin lkuligin closed this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants