Skip to content

[BUG] Remove subprocess pip install at import time - #7531

Open
PiedPiper911 wants to merge 1 commit into
chroma-core:mainfrom
PiedPiper911:fix-7402-remove-subprocess-pip-install
Open

PiedPiper911 wants to merge 1 commit into
chroma-core:mainfrom
PiedPiper911:fix-7402-remove-subprocess-pip-install

Conversation

@PiedPiper911

Copy link
Copy Markdown

Problem

Fixes #7402

When importing in Google Colab (or any environment with SQLite < 3.35.0), the module silently executes at import time. This:

  1. Violates import side-effect principles - importing a library should not modify the user's environment
  2. Fails on non-standard architectures - has no prebuilt wheels for ppc64, s390x, etc., causing import to fail with a pip error instead of a clear version mismatch message
  3. Bypasses package management - silently running pip can conflict with virtual environments, air-gapped systems, and production deployments
  4. Creates security concerns - auto-installing packages without user consent is an anti-pattern

Solution

Removed the Colab-specific branch entirely. Now all environments with old SQLite receive the same clear directing users to the troubleshooting documentation.

Before

After

The function and constant remain available for telemetry use (they are used in ).

Why this approach

Users on Colab who need a newer SQLite can follow the same troubleshooting guide as everyone else. If is needed as a dependency, it should be declared in build requirements, not installed imperatively at runtime.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions

Copy link
Copy Markdown

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@PiedPiper911

Copy link
Copy Markdown
Author

Hi! Following up on this fix removing subprocess pip install at import time. Happy to provide more context or make changes. Thanks!

@PiedPiper911 PiedPiper911 changed the title fix: remove subprocess pip install at import time [BUG] Remove subprocess pip install at import time Sep 9, 2026
@PiedPiper911
PiedPiper911 force-pushed the fix-7402-remove-subprocess-pip-install branch from ade1ded to 31a4315 Compare November 14, 2026 05:27
Importing `chromadb` could shell out to `pip install pysqlite3-binary` on Colab
when the system sqlite3 was older than 3.35. Installing a package as a side
effect of an import is unreliable (no network, read-only environments, pinned
images), and it silently replaced `sys.modules["sqlite3"]` under the caller.

The version check now always raises the actionable error, on Colab and
elsewhere. `is_in_colab()` and `IN_COLAB` are kept: the product telemetry
module imports `is_in_colab` (`from chromadb import is_in_colab`), so the Colab
signal is still reported.

The error message is rebuilt from adjacent literals, preserving the colour
codes and the trailing newline, and dropping the padding that the old
backslash-continuation baked into the text.

Rebased onto current main, so `__version__` stays at 1.6.0; the diff against
main is +7/-18 and nothing else moves.
@PiedPiper911
PiedPiper911 force-pushed the fix-7402-remove-subprocess-pip-install branch from 31a4315 to a6cd57b Compare November 14, 2026 05:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Rework chromadb/__init__.py to avoid [sys.executable, "-m", "pip", "install", "pysqlite3-binary"]

1 participant