This is a common dependency conflict. So, sometimes, when you successfully install crewAI, you may encounter problems when using it. To resolve this, you need to install the specific version of litellm
that crewai
requires.
The quickest solution is to downgrade your litellm
package.
Bash
pip install litellm==1.74.9
Running this command will uninstall version 1.77.1
and install the required version 1.74.9
.
Why This Happens
When you install a Python package like crewai
, it has a list of other packages it depends on, sometimes with very specific version requirements. In this case, crewai
version 0.186.1
was built and tested to work with litellm
version 1.74.9
exactly. Using a newer version can lead to unexpected errors because of changes in the code.
Best Practice: Use a Virtual Environment 🌱
To avoid these issues in the future, it’s highly recommended to use a virtual environment for each of your projects. This creates an isolated space with its own set of installed packages, preventing conflicts between projects.
Here’s how to do it:
- Create a virtual environment:
- Navigate to your project folder in the terminal.
- Run the following command:
Bash# For macOS/Linux python3 -m venv venv
# For Windows python -m venv venv
- Activate the environment:
- You must activate the environment each time you work on the project.
Bash# For macOS/Linux source venv/bin/activate
# For Windows .\venv\Scripts\activate
- You’ll know it’s active when you see
(venv)
at the beginning of your terminal prompt.
- You must activate the environment each time you work on the project.
- Install your packages:
- Now, with the environment active, install
crewai
. Pip will automatically handle installing the correct dependencies, includinglitellm==1.74.9
.
Bashpip install crewai==0.186.1
- Now, with the environment active, install