Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Chroma crash with the new numpy version - update requirements.txt #2352

Closed
wants to merge 2 commits into from

Conversation

itayB
Copy link

@itayB itayB commented Jun 16, 2024

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • NumPy just released their next major version and chroma is crashing
    import chromadb
  File "/usr/local/lib/python3.12/site-packages/chromadb/__init__.py", line 3, in <module>
    from chromadb.api.client import Client as ClientCreator
  File "/usr/local/lib/python3.12/site-packages/chromadb/api/__init__.py", line 7, in <module>
    from chromadb.api.models.Collection import Collection
  File "/usr/local/lib/python3.12/site-packages/chromadb/api/models/Collection.py", line 7, in <module>
    import chromadb.utils.embedding_functions as ef
  File "/usr/local/lib/python3.12/site-packages/chromadb/utils/embedding_functions.py", line 7, in <module>
    from chromadb.api.types import (
  File "/usr/local/lib/python3.12/site-packages/chromadb/api/types.py", line 102, in <module>
    ImageDType = Union[np.uint, np.int_, np.float_]
                                         ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'?

Suggesting locking before version 2 as a first Aid

Copy link

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)

@itayB itayB marked this pull request as ready for review June 16, 2024 14:31
@itayB itayB changed the title Update requirements.txt Chroma crash with the new numpy version - update requirements.txt Jun 16, 2024
@HammadB
Copy link
Collaborator

HammadB commented Jun 16, 2024

Thanks for flagging we will cut a new release this week to patch this

Copy link
Contributor

@atroyn atroyn left a comment

Choose a reason for hiding this comment

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

Thanks for raising this. Was successfully able to reproduce, and this is due to Chroma using now deprecated generic types in some of our multimodal datatypes:

ImageDType = Union[np.uint, np.int_, np.float_]

This is an easy fix, but unfortunately on further testing I found that onnxruntime which is upstream of us is also broken by numpy 2.0.

Pinning the version is probably the way to go! Let's keep the previous requirement to be above 1.22.5, while introducing this new one too.

requirements.txt Show resolved Hide resolved
@atroyn atroyn changed the title Chroma crash with the new numpy version - update requirements.txt [FIX] Chroma crash with the new numpy version - update requirements.txt Jun 16, 2024
requirements.txt Outdated Show resolved Hide resolved
@itayB itayB requested a review from atroyn June 17, 2024 03:50
@itayB
Copy link
Author

itayB commented Jun 17, 2024

Thanks for raising this. Was successfully able to reproduce, and this is due to Chroma using now deprecated generic types in some of our multimodal datatypes:

ImageDType = Union[np.uint, np.int_, np.float_]

This is an easy fix, but unfortunately on further testing I found that onnxruntime which is upstream of us is also broken by numpy 2.0.

Pinning the version is probably the way to go! Let's keep the previous requirement to be above 1.22.5, while introducing this new one too.

done, thanks

Copy link
Author

@itayB itayB left a comment

Choose a reason for hiding this comment

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

same happens here now: #2356

@atroyn
Copy link
Contributor

atroyn commented Jun 17, 2024

same happens here now: #2356

I didn’t see this in my testing but will check again.

@atroyn atroyn changed the title [FIX] Chroma crash with the new numpy version - update requirements.txt [BUG] Chroma crash with the new numpy version - update requirements.txt Jun 17, 2024
@HammadB
Copy link
Collaborator

HammadB commented Jun 17, 2024

Closing this in favor of #2360 since we needed a few additional changes and I didn't want to hold up the fix on a review cycle - I really appreciate the fix here @itayB

@HammadB HammadB closed this Jun 17, 2024
HammadB added a commit that referenced this pull request Jun 17, 2024
## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
- Numpy 2.0 has some type changes which break our code. This was flagged
by @itayB in #2352 (Thank you!). We need to extend that PR a bit to
include other requirements for the thin client, as well as the
pyproject.toml.
- Note: We could fix these type issues but Onnxruntime does not yet
support python 2.0 - which we depend on
(microsoft/onnxruntime#21063)
 - New functionality
	 - None

## Test plan
*How are these changes tested?*
- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
We may want to update our docs? I am not sure what makes sense here -
input solicited.
Anush008 pushed a commit to Anush008/chroma that referenced this pull request Jun 27, 2024
…a-core#2360)

## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
- Numpy 2.0 has some type changes which break our code. This was flagged
by @itayB in chroma-core#2352 (Thank you!). We need to extend that PR a bit to
include other requirements for the thin client, as well as the
pyproject.toml.
- Note: We could fix these type issues but Onnxruntime does not yet
support python 2.0 - which we depend on
(microsoft/onnxruntime#21063)
 - New functionality
	 - None

## Test plan
*How are these changes tested?*
- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
We may want to update our docs? I am not sure what makes sense here -
input solicited.
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.

3 participants