crewAIInc/crewAI

[BUG] `import crewai` takes >25 seconds

Closed this issue · 5 comments

Description

import crewai takes >25 seconds

Steps to Reproduce

  1. import crewai
  2. run the script
  3. wait 25 seconds or longer

Expected behavior

The library should be imported in fraction of second.

Screenshots/Code snippets

import time
start = time.time()

import crewai

print(time.time() - start)

Operating System

Windows 10

Python Version

3.12

crewAI Version

0.32.2

crewAI Tools Version

0.3.0

Virtual Environment

Venv

Evidence

Code_wIKMXiY1iv

Possible Solution

None

Additional context

None

I've tested this on another (faster) computer and I can confirm the bug is real.

I did some deeper testing and it's worse every new update:

| version | time `import crewai` takes |
| ------- | -------------------------- |
| master  | 18.4s                      |
| v0.63.6 | 16.4s                      |
| v0.63.0 | 16.3s                      |
| v0.61.0 | 15.9s                      |
| v0.60.0 | 15.8s                      |
| v0.55.2 | 14.3s                      |
| v0.51.0 | 13.9s                      |
| v0.41.1 | 13.6s                      |
| v0.41.0 | 13.8s                      |
| v0.36.0 | 13.7s                      |
| v0.35.8 | 12.0s                      |
| v0.35.0 | 11.8s                      |
| v0.32.2 | 11.0s                      |
| v0.32.1 | 11.7s                      |
| v0.32.0 | 11.6s                      |
| v0.30.8 | 6.7s                       |
| v0.28.5 | 6.2s                       |
| v0.27.0 | 6.2s                       |

Just for comparison, I've also tested AutoGen and LangGraph:

| library   | time `import` takes |
| --------- | ------------------- |
| crewai    | 18.4s               |
| autogen   |  2.2s               |
| langgraph |  2.3s               |

For some reason on Google Colab it's super-fast (like <0.001s). So I tried more things:

  • Downgraded Python from 3.12 to 3.10, because on Google Colab they have also Python 3.10. Result: It's a little bit faster - instead of 16s I've got 10s.
  • Since Google Colab uses Linux, I've tried to install Python 3.10 to Ubuntu using WSL. Result: The same, still ~10s as on Windows.

I don't know what's going on here, but importing a Python Library definitely shouldn't take several seconds without even using it yet.

Thanks for calling this out, I have raised internally, will keep you posted

I've come across this tool (Tuna) so I generated some import crewai statistics using that tool (crewai v0.63.6):

Screenshot 2024-10-03 at 11-52-35 tuna - import-crewai log