-
Notifications
You must be signed in to change notification settings - Fork 9
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
Error on Import #1
Comments
It looks as if numba is balking at some type issues, but it is not clear to
me what those could be from the error. This has worked acceptably on a few
different machines and configurations I tried, so it isn't the default
state of things.
What version of numba are you using?
…On Wed, Mar 15, 2023 at 7:21 PM zilch42 ***@***.***> wrote:
Hi there, I'm getting an error trying to import HDBSCAN from fast_hdbscan
from fast_hdbscan import HDBSCAN
---------------------------------------------------------------------------
TypingError Traceback (most recent call last)
Cell In[1], line 10
8 from sklearn.feature_extraction.text import CountVectorizer
9 from umap import UMAP
---> 10 from fast_hdbscan import HDBSCAN
11 import pickle
12 import sys
File [c:\Users\abb064\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\fast_hdbscan\__init__.py:7](file:///C:/Users/abb064/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/fast_hdbscan/__init__.py:7)
5 random_state = np.random.RandomState(42)
6 random_data = random_state.random(size=(100, 3))
----> 7 HDBSCAN(allow_single_cluster=True).fit(random_data)
8 HDBSCAN(cluster_selection_method="leaf").fit(random_data)
10 __all__ = ["HDBSCAN", "fast_hdbscan"]
File [c:\Users\abb064\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\fast_hdbscan\hdbscan.py:217](file:///C:/Users/abb064/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/fast_hdbscan/hdbscan.py:217), in HDBSCAN.fit(self, X, y, **fit_params)
207 clean_data = X
209 kwargs = self.get_params()
211 (
212 self.labels_,
213 self.probabilities_,
214 self._single_linkage_tree,
215 self._condensed_tree,
216 self._min_spanning_tree,
--> 217 ) = fast_hdbscan(clean_data, return_trees=True, **kwargs)
219 self._condensed_tree = to_numpy_rec_array(self._condensed_tree)
221 if not self._all_finite:
222 # remap indices to align with original data in the case of non-finite entries.
File [c:\Users\abb064\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\fast_hdbscan\hdbscan.py:149](file:///C:/Users/abb064/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/fast_hdbscan/hdbscan.py:149), in fast_hdbscan(data, min_samples, min_cluster_size, cluster_selection_method, allow_single_cluster, return_trees)
147 sklearn_tree = KDTree(data)
148 numba_tree = kdtree_to_numba(sklearn_tree)
--> 149 edges = parallel_boruvka(
150 numba_tree, min_samples=min_cluster_size if min_samples is None else min_samples
151 )
152 sorted_mst = edges[np.argsort(edges.T[2])]
153 linkage_tree = mst_to_linkage_tree(sorted_mst)
File [c:\Users\abb064\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\fast_hdbscan\boruvka.py:270](file:///C:/Users/abb064/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/fast_hdbscan/boruvka.py:270), in parallel_boruvka(tree, min_samples)
267 while n_components > 1:
268 candidate_distances, candidate_indices = boruvka_tree_query(tree, node_components, point_components,
269 core_distances)
--> 270 new_edges = merge_components(components_disjoint_set, candidate_indices, candidate_distances, point_components)
271 update_component_vectors(tree, components_disjoint_set, node_components, point_components)
273 edges = np.vstack((edges, new_edges))
File [c:\Users\abb064\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\numba\core\dispatcher.py:468](file:///C:/Users/abb064/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/numba/core/dispatcher.py:468), in _DispatcherBase._compile_for_args(self, *args, **kws)
464 msg = (f"{str(e).rstrip()} \n\nThis error may have been caused "
465 f"by the following argument(s):\n{args_str}\n")
466 e.patch_message(msg)
--> 468 error_rewrite(e, 'typing')
469 except errors.UnsupportedError as e:
470 # Something unsupported is present in the user code, add help info
471 error_rewrite(e, 'unsupported_error')
...
File ".[.\..\..\..\..\AppData\Local\miniconda3\envs\csiro-horizon-scanning39\lib\site-packages\fast_hdbscan\boruvka.py](https://file+.vscode-resource.vscode-cdn.net/c%3A/Users/abb064/OneDrive%20-%20CSIRO/AppData/Local/miniconda3/envs/csiro-horizon-scanning39/lib/site-packages/fast_hdbscan/boruvka.py)", line 9:
def merge_components(disjoint_set, candidate_neighbors, candidate_neighbor_distances, point_components):
component_edges = {0: (0, np.int32(1), np.float32(0.0)) for i in range(0)}
Python 3.9.16
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3IUBIUEQ6USTT5QXR53NTW4JFIDANCNFSM6AAAAAAV4PR6HY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Numba 0.56.4 Here is my whole environment
|
Running into the same error. I have this additional error message:
Python 3.9.0 Seems like a int32 vs int64 in a dict key problem. EDIT: found it. Will create a PR |
Getting a kinda different import error: TypingError Traceback (most recent call last)
Cell In[1], line 20
18 import optuna
19 import multiprocessing
---> 20 import fast_hdbscan
File [c:\Users\.venv\Lib\site-packages\fast_hdbscan\__init__.py:7](file:///C:/Users/.venv/Lib/site-packages/fast_hdbscan/__init__.py:7)
5 random_state = np.random.RandomState(42)
6 random_data = random_state.random(size=(100, 3))
----> 7 HDBSCAN(allow_single_cluster=True).fit(random_data)
8 HDBSCAN(cluster_selection_method="leaf").fit(random_data)
10 __all__ = ["HDBSCAN", "fast_hdbscan"]
File [c:\Users\.venv\Lib\site-packages\fast_hdbscan\hdbscan.py:217](file:///C:/Users/.venv/Lib/site-packages/fast_hdbscan/hdbscan.py:217), in HDBSCAN.fit(self, X, y, **fit_params)
207 clean_data = X
209 kwargs = self.get_params()
211 (
212 self.labels_,
213 self.probabilities_,
214 self._single_linkage_tree,
215 self._condensed_tree,
216 self._min_spanning_tree,
--> 217 ) = fast_hdbscan(clean_data, return_trees=True, **kwargs)
219 self._condensed_tree = to_numpy_rec_array(self._condensed_tree)
...
File "..\.venv\Lib\site-packages\fast_hdbscan\boruvka.py", line 9:
def merge_components(disjoint_set, candidate_neighbors, candidate_neighbor_distances, point_components):
component_edges = {0: (0, np.int32(1), np.float32(0.0)) for i in range(0)}
My environment:
|
I had to downgrade numpy 2.0.2 to1.23.X to get rid of a numpy error on import. (Something about np.boool8 not existing). |
I'm hoping that as numpy and numba settle down with reagrd to the new APIs etc. that some of this will magically resolve itself ( I don't think this package does anything weird, or uses anything particularly specific/internal). For now I'll keep it as a "wait and see". |
Hi there, I'm getting an error trying to import HDBSCAN from fast_hdbscan
from fast_hdbscan import HDBSCAN
Python 3.9.16
The text was updated successfully, but these errors were encountered: