Skip to content

Error: np.float_ removed #2715

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

Closed
ruidazeng opened this issue Nov 27, 2024 · 6 comments
Closed

Error: np.float_ removed #2715

ruidazeng opened this issue Nov 27, 2024 · 6 comments

Comments

@ruidazeng
Copy link

Why am I getting this error? How can I fix this? It does not seem like serializer.py:50 has np_float_.

tests\test_search.py:196: in <module>
    @require_elasticsearch
tests\utils.py:101: in require_elasticsearch
    import elasticsearch  # noqa
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\elasticsearch\__init__.py:32: in <module>
    from .client import Elasticsearch
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\elasticsearch\client\__init__.py:22: in <module>
    from ..transport import Transport, TransportError
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\elasticsearch\transport.py:23: in <module>
    from .serializer import JSONSerializer, Deserializer, DEFAULT_SERIALIZERS
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\elasticsearch\serializer.py:50: in <module>
    np.float_,
C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\numpy\__init__.py:411: in __getattr__
    raise AttributeError(
E   AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.
@pquentin
Copy link
Member

Hello, what versions of elasticsearch-py are you using? This was fixed in #2551 and released in 8.15.0 (August 2024) and 7.17.12 (September 2024).

@ruidazeng
Copy link
Author

ruidazeng commented Nov 28, 2024

Hello, what versions of elasticsearch-py are you using? This was fixed in #2551 and released in 8.15.0 (August 2024) and 7.17.12 (September 2024).

 + elasticsearch==7.9.1

It is the default version in uv

Run pip install --upgrade uv
Collecting uv
  Downloading uv-0.5.4-py3-none-win_amd64.whl.metadata (11 kB)
Downloading uv-0.5.4-py3-none-win_amd64.whl (15.6 MB)
   ---------------------------------------- 15.6/15.6 MB 98.2 MB/s eta 0:00:00
Installing collected packages: uv
Successfully installed uv-0.5.4
3m 12s
Run uv pip install --system "tests @ ."
Using Python 3.11.9 environment at C:\hostedtoolcache\windows\Python\3.11.9\x64

@pquentin
Copy link
Member

pquentin commented Nov 28, 2024

7.9.1 is more than 4 years old at this point. There's no such thing as a uv default version, also your output doesn't show which version was actually installed.

@ruidazeng
Copy link
Author

7.9.1 is more than 4 years old at this point. There's no such thing as a uv default version, also your output doesn't show which version was actually installed.

How do I get the latest version of elasticsearch, or at least 7.17.12 or above?

Using Python 3.11.9 environment at C:\hostedtoolcache\windows\Python\3.11.9\x64
Resolved 163 packages in 9.51s
Prepared 162 packages in 2m 29s
Installed 162 packages in 35.95s
 + docker==7.1.0
 + elasticsearch==7.9.1
 + execnet==2.1.1

@pquentin
Copy link
Member

The bug tracker is here for verified bug reports, and user questions should use the language-clients tag on our forums: https://discuss.elastic.co/tag/language-clients. That said, what is the output of uv tree? There is surely a constraint in your pyproject.toml file somewhere that requires this old version of the client.

@ruidazeng
Copy link
Author

The bug tracker is here for verified bug reports, and user questions should use the language-clients tag on our forums: https://discuss.elastic.co/tag/language-clients. That said, what is the output of uv tree? There is surely a constraint in your pyproject.toml file somewhere that requires this old version of the client.

Found the constraint here:
"elasticsearch<8.0.0",

Didn't think it will take me all the way back to 7.9.1 though but the issue is fixed.

Thanks for the bug tracker forum!~

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

No branches or pull requests

2 participants