Skip to content

[BUG] ModuleNotFoundError: No module named 'litellm' After Upgrading to CrewAI 1.0.0 #3750

Description

@mustafaelshobaky

Description

Describe the bug
After upgrading to CrewAI 1.0.0, attempts to convert text to a Pydantic model fail with the following error:

Failed to convert text into a Pydantic model due to error: No module named 'litellm'

This occurs during the model conversion process inside crewai/utilities/converter.py, where the code tries to import litellm from within internal_instructor.py.

⚙️ Environment Details

CrewAI version: 1.0.0

Python version: 3.11

OS: (e.g., Ubuntu 22.04 / macOS / Windows WSL2)

Installation method: pip install crewai --upgrade

Steps to Reproduce

🧩 Steps to Reproduce

Upgrade CrewAI to version 1.0.0:

pip install -U crewai

Run any code that uses Crew().convert_to_model() or .to_pydantic().

Observe that it fails with ModuleNotFoundError: No module named 'litellm'.

Expected behavior

✅ Expected Behavior

The conversion to a Pydantic model should work without requiring manual installation of litellm, or the dependency should be automatically installed as part of the CrewAI package.

🚑 Actual Behavior

The call fails with ModuleNotFoundError, halting all conversions that rely on InternalInstructor.

Screenshots/Code snippets

🔍 Full Traceback
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/crewai/utilities/converter.py", line 167, in convert_to_model
escaped_result = json.dumps(json.loads(result, strict=False))
...
json.decoder.JSONDecodeError: Unterminated string starting at: line 447 column 27 (char 24590)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/crewai/utilities/converter.py", line 56, in to_pydantic
result = self._create_instructor().to_pydantic()
File "/usr/local/lib/python3.11/site-packages/crewai/utilities/converter.py", line 137, in _create_instructor
return InternalInstructor(
File "/usr/local/lib/python3.11/site-packages/crewai/utilities/internal_instructor.py", line 65, in init
from litellm import completion
ModuleNotFoundError: No module named 'litellm'

Operating System

Windows 11

Python Version

3.11

crewAI Version

1.0.0

crewAI Tools Version

1.0.0

Virtual Environment

Venv

Evidence

Image

Possible Solution

💡 Suggested Fix

Either:

Add litellm to the CrewAI install_requires in setup.py or pyproject.toml,
or

Handle the missing dependency gracefully with an internal fallback or optional import check.

Additional context

📎 Additional Context

This issue started immediately after updating to version 1.0.0, indicating it might be a packaging or dependency oversight in the new release.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions