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

backwards compatibility #15

Open
HPicatto opened this issue Nov 28, 2024 · 0 comments
Open

backwards compatibility #15

HPicatto opened this issue Nov 28, 2024 · 0 comments

Comments

@HPicatto
Copy link

HPicatto commented Nov 28, 2024

It mentions that numpy>=1.21 should work. In my case:

>>> np.__version__
'1.26.4'

but the example in readme rises this error:

Python 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:27:40) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'1.26.4'
>>> import sklearn as sc
>>> sc.__version__
'1.5.2'
>>> import numba 
>>> numba.__version__
'0.60.0'
>>> import tqdm
>>> tqdm.__version__
'4.67.1'
>>> import evoc
/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/evoc/float_nndescent.py:292: NumbaTypeSafetyWarning: unsafe cast from uint64 to int64. Precision may be lost.
  points = point_indices[i]
>>> from sklearn.datasets import make_blobs
>>> 
>>> data, _ = make_blobs(n_samples=100_000, n_features=1024, centers=100)
>>> 
>>> clusterer = evoc.EVoC()
>>> cluster_labels = clusterer.fit_predict(data)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/evoc/clustering.py", line 531, in fit_predict
    evoc_clusters(
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/evoc/clustering.py", line 362, in evoc_clusters
    cluster_layers, membership_strengths = build_cluster_layers(
                                           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/evoc/clustering.py", line 45, in build_cluster_layers
    new_tree = condense_tree(uncondensed_tree, base_min_cluster_size)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 442, in _compile_for_args
    raise e
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 375, in _compile_for_args
    return_val = self.compile(tuple(argtypes))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 905, in compile
    cres = self._compiler.compile(args, return_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 80, in compile
    status, retval = self._compile_cached(args, return_type)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 94, in _compile_cached
    retval = self._compile_core(args, return_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/dispatcher.py", line 107, in _compile_core
    cres = compiler.compile_extra(self.targetdescr.typing_context,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler.py", line 744, in compile_extra
    return pipeline.compile_extra(func)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler.py", line 438, in compile_extra
    return self._compile_bytecode()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler.py", line 506, in _compile_bytecode
    return self._compile_core()
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler.py", line 481, in _compile_core
    raise e
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler.py", line 472, in _compile_core
    pm.run(self.state)
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 364, in run
    raise e
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 356, in run
    self._runPass(idx, pass_inst, state)
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 311, in _runPass
    mutated |= check(pss.run_pass, internal_state)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 273, in check
    mangled = func(compiler_state)
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typed_passes.py", line 112, in run_pass
    typemap, return_type, calltypes, errs = type_inference_stage(
                                            ^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typed_passes.py", line 93, in type_inference_stage
    errs = infer.propagate(raise_errors=raise_errors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typeinfer.py", line 1083, in propagate
    errors = self.constraints.propagate(self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typeinfer.py", line 182, in propagate
    raise e
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typeinfer.py", line 160, in propagate
    constraint(typeinfer)
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typeinfer.py", line 725, in __call__
    attrty = typeinfer.context.resolve_getattr(ty, self.attr)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typing/context.py", line 283, in resolve_getattr
    attrty = self.resolve_module_constants(typ, attr)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numba/core/typing/context.py", line 348, in resolve_module_constants
    attrval = getattr(typ.pymod, attr)
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/picatto/ascii/research-space/.pixi/envs/research-cuda/lib/python3.11/site-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?

adding the np.bool_ will solve the issue If you give me permissions to create new branches I can create a PR to solve this. I've tested that it works with most recent numpy version and also '1.26.4' which should be as current specification

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

1 participant