Skip to content

fix: make lancedb an optional dependency under [memory] extras#5328

Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1775598560-make-lancedb-optional
Open

fix: make lancedb an optional dependency under [memory] extras#5328
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1775598560-make-lancedb-optional

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 7, 2026

Summary

Moves lancedb from a mandatory core dependency to an optional [memory] extras group (pip install crewai[memory]). This fixes #5327lancedb>=0.29.2 dropped macOS x86_64 (Intel) wheels, making crewai completely uninstallable on all Intel Macs, even for projects that never use memory features.

Changes:

  • lib/crewai/pyproject.toml: Removed lancedb from core deps, added new memory = ["lancedb>=0.29.2,<0.30.1"] optional extras group
  • lancedb_storage.py: Wrapped import lancedb in try/except; LanceDBStorage.__init__ raises a clear ImportError with install instructions when lancedb is absent
  • Added 6 new tests validating optional dependency behavior (missing lancedb raises helpful error, custom storage backends bypass lancedb, pyproject.toml structure is correct, etc.)

Review & Testing Checklist for Human

  • Breaking change assessment: This is a breaking change for users who rely on memory features. pip install crewai will no longer include lancedb. Users must switch to pip install crewai[memory]. Verify this tradeoff is acceptable vs. a deprecation warning period.
  • Flow auto-creates Memory with storage="lancedb" by default: Any Flow subclass will hit the new ImportError at runtime if lancedb is not installed, even if the user never calls remember()/recall(). Consider whether the default should change to a no-op or lazy check only when memory is actually used.
  • Documentation: No docs were updated. The install guides, memory docs, and changelog should reflect pip install crewai[memory].
  • Test on Intel Mac: Verify pip install crewai succeeds on macOS x86_64 without lancedb, and pip install crewai[memory] still works on supported platforms.

Notes

  • The memory_tui.py and unified_memory.py already use lazy/guarded imports of LanceDBStorage, so the ImportError from lancedb_storage.py propagates naturally through existing error paths.
  • The uv.lock diff is auto-generated from the pyproject.toml change.

Link to Devin session: https://app.devin.ai/sessions/e6e9627734c640b7a42ec4c85d5ab96f


Note

Medium Risk
Changes packaging so lancedb is no longer installed by default, which can break runtime for users relying on the default Memory(storage='lancedb') unless they add the new crewai[memory] extra. Runtime impact is limited to memory/LanceDB usage and now fails fast with a clear ImportError.

Overview
Makes lancedb an optional dependency by moving it from core requirements to a new memory extra (pip install crewai[memory]), and updates uv.lock accordingly.

Updates LanceDBStorage to tolerate missing lancedb at import time and to raise a clear ImportError with installation instructions when instantiated. Adds tests ensuring crewai can be imported without lancedb, memory initialization fails with the expected message when LanceDB is selected, and custom storage backends don’t require lancedb.

Reviewed by Cursor Bugbot for commit da4b610. Bugbot is set up for automated code reviews on this repo. Configure here.

Moves lancedb from core dependencies to optional [memory] extras group
in pyproject.toml. This unblocks installation on Intel Macs where
lancedb>=0.29.2 has no macOS x86_64 wheels.

- Add try/except around lancedb import in lancedb_storage.py
- Raise clear ImportError with install instructions when lancedb is absent
- Add 6 tests covering optional dependency behavior
- Existing memory tests continue to pass

Closes #5327

Co-Authored-By: João <joao@crewai.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Prompt hidden (unlisted session)

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions github-actions bot added the size/M label Apr 7, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7bec692. Configure here.

mod.LanceDBStorage(path=str(tmp_path / "mem"))

# Restore the module to its original state
importlib.reload(mod)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test module restoration happens inside patched context

Low Severity

The importlib.reload(mod) calls intended to "restore the module to its original state" execute inside the with patch.dict(sys.modules, {"lancedb": None}) block. Since sys.modules["lancedb"] is still None during the reload, the module's lancedb variable remains None after the test. This causes test pollution — subsequent tests in the same session that use LanceDBStorage will see lancedb as None and fail unexpectedly.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7bec692. Configure here.

devin-ai-integration bot and others added 2 commits April 7, 2026 22:02
Co-Authored-By: João <joao@crewai.com>
…move unused assignment ignore

Co-Authored-By: João <joao@crewai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] crewai 1.12.2 uninstallable on Intel Macs: mandatory lancedb>=0.29.2 dependency has no macOS x86_64 wheels

0 participants