litellm - 💡(How to fix) Fix [Bug]: Ollama Vision VLM calls not working due to missing pillow [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#27183Fetched 2026-05-06 06:15:41
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Request Failed Error Code: 500 Message: litellm.APIConnectionError: ollama image conversion failed please run pip install PillowTraceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 28, in _convert_image from PIL import Image ModuleNotFoundError: No module named 'PIL' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/main.py", line 3988, in completion response = base_llm_http_handler.completion( model=model, ...<14 lines>... client=client, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 415, in completion data = provider_config.transform_request( model=model, ...<3 lines>... headers=headers, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/completion/transformation.py", line 448, in transform_request _convert_image(convert_to_ollama_image(image)) for image in images ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 30, in _convert_image raise Exception( "ollama image conversion failed please runpip install Pillow" ) Exception: ollama image conversion failed please run pip install Pillow . Received Model Group=gemma4:31b-it-q8_0 Available Model Group Fallbacks=None LiteLLM Retried: 3 times, LiteLLM Max Retries: 3

Code Example

`Request Failed
Error Code: 500
Message: litellm.APIConnectionError: ollama image conversion failed please run `pip install Pillow` Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 28, in _convert_image from PIL import Image ModuleNotFoundError: No module named 'PIL' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/main.py", line 3988, in completion response = base_llm_http_handler.completion( model=model, ...<14 lines>... client=client, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 415, in completion data = provider_config.transform_request( model=model, ...<3 lines>... headers=headers, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/completion/transformation.py", line 448, in transform_request _convert_image(convert_to_ollama_image(image)) for image in images ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 30, in _convert_image raise Exception( "ollama image conversion failed please run `pip install Pillow`" ) Exception: ollama image conversion failed please run `pip install Pillow` . Received Model Group=gemma4:31b-it-q8_0 Available Model Group Fallbacks=None LiteLLM Retried: 3 times, LiteLLM Max Retries: 3`
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

I run a VLM chat call with an image to a proxied ollama model.

I'm on container image: docker.litellm.ai/berriai/litellm-database:v1.83.14-stable

I was able to fix the issue by manually installing pillow in the container image using pip.

Steps to Reproduce

  1. Run chat request to an ollama model (e.g. gemma4)
  2. Observe 500 error.

Relevant log output

`Request Failed
Error Code: 500
Message: litellm.APIConnectionError: ollama image conversion failed please run `pip install Pillow` Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 28, in _convert_image from PIL import Image ModuleNotFoundError: No module named 'PIL' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/.venv/lib/python3.13/site-packages/litellm/main.py", line 3988, in completion response = base_llm_http_handler.completion( model=model, ...<14 lines>... client=client, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 415, in completion data = provider_config.transform_request( model=model, ...<3 lines>... headers=headers, ) File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/completion/transformation.py", line 448, in transform_request _convert_image(convert_to_ollama_image(image)) for image in images ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/litellm/llms/ollama/common_utils.py", line 30, in _convert_image raise Exception( "ollama image conversion failed please run `pip install Pillow`" ) Exception: ollama image conversion failed please run `pip install Pillow` . Received Model Group=gemma4:31b-it-q8_0 Available Model Group Fallbacks=None LiteLLM Retried: 3 times, LiteLLM Max Retries: 3`

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.14-stable

Twitter / LinkedIn details

No response

extent analysis

TL;DR

Install the Pillow library using pip to resolve the ollama image conversion failure.

Guidance

  • The error message indicates a ModuleNotFoundError: No module named 'PIL', which suggests that the Pillow library is not installed.
  • The issue can be fixed by installing Pillow using pip, as manually done by the user in the container image.
  • To prevent similar issues in the future, consider including Pillow in the container image's dependencies.
  • Verify that the fix worked by running the chat request to the ollama model again and checking for the 500 error.

Example

No code snippet is necessary in this case, as the solution involves installing a library using pip.

Notes

The provided solution assumes that the container image is based on a Python environment where pip is available. If this is not the case, alternative installation methods may be necessary.

Recommendation

Apply workaround: Install Pillow using pip, as this directly addresses the reported error and has already been verified by the user to resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING