TutteInstitute / fast_hdbscan

A fast multi-core implementation of HDBSCAN for low dimensional Euclidean spaces
BSD 2-Clause "Simplified" License
95 stars 8 forks source link

AttributeError #13

Open cccxg opened 1 year ago

cccxg commented 1 year ago

Got an AttributeError.

Code:

import fast_hdbscan
from sklearn.datasets import make_blobs

data, _ = make_blobs(1000)

clusterer = fast_hdbscan.HDBSCAN(min_cluster_size=10)
cluster_labels = clusterer.fit_predict(data)

Output:

PS C:\Users\Administrator\Desktop\alg> python .\hdbscan.py
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\alg\hdbscan.py", line 1, in <module>
    import fast_hdbscan
  File "C:\Python\Python311\Lib\site-packages\fast_hdbscan\__init__.py", line 1, in <module>
    from .hdbscan import HDBSCAN, fast_hdbscan
  File "C:\Python\Python311\Lib\site-packages\fast_hdbscan\hdbscan.py", line 22, in <module>
    from hdbscan.plots import CondensedTree, SingleLinkageTree, MinimumSpanningTree
  File "C:\Users\Administrator\Desktop\alg\hdbscan.py", line 6, in <module>
    clusterer = fast_hdbscan.HDBSCAN(min_cluster_size=10)
                ^^^^^^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'fast_hdbscan' has no attribute 'HDBSCAN' (most likely due to a circular import)

Packages:

Package               Version
--------------------- -----------
asttokens             2.2.1
backcall              0.2.0
beautifulsoup4        4.11.2
bs4                   0.0.1
certifi               2022.12.7
chardet               3.0.4
charset-normalizer    3.0.1
click                 8.1.3
colorama              0.4.6
comm                  0.1.2
contourpy             1.0.7
cycler                0.11.0
debugpy               1.6.6
decorator             5.1.1
et-xmlfile            1.1.0
executing             1.2.0
fast-hdbscan          0.1.0
fonttools             4.38.0
greenlet              2.0.2
idna                  3.4
ipykernel             6.21.1
ipython               8.9.0
itsdangerous          2.1.2
jedi                  0.18.2
jieba                 0.42.1
Jinja2                3.1.2
joblib                1.3.1
jupyter_client        8.0.2
jupyter_core          5.2.0
kiwisolver            1.4.4
llvmlite              0.40.1
lxml                  4.9.2
MarkupSafe            2.1.2
matplotlib            3.7.0
matplotlib-inline     0.1.6
nest-asyncio          1.5.6
numba                 0.57.1
numpy                 1.24.2
openpyxl              3.1.0
packaging             23.0
pandas                1.5.3
parso                 0.8.3
pickleshare           0.7.5
Pillow                9.4.0
pip                   22.3.1
platformdirs          3.0.0
prompt-toolkit        3.0.36
psutil                5.9.4
pure-eval             0.2.2
Pygments              2.14.0
pymongo               3.7.2
PyMySQL               1.0.2
pyparsing             3.0.9
python-dateutil       2.8.2
pytz                  2022.7.1
pytz-deprecation-shim 0.1.0.post0
pywin32               305
pyzmq                 25.0.0
requests              2.28.2
scikit-learn          1.3.0
scipy                 1.11.1
setuptools            65.5.0
six                   1.16.0
sklearn               0.0.post5
snownlp               0.12.3
soupsieve             2.3.2.post1
SQLAlchemy            2.0.3
stack-data            0.6.2
threadpoolctl         3.1.0
toml                  0.10.2
tornado               6.2
tqdm                  4.64.0
traitlets             5.9.0
treelib               1.6.4
typing_extensions     4.5.0
tzdata                2022.7
urllib3               1.25.11
wcwidth               0.2.6
Werkzeug              2.2.3
WTForms               3.0.1
xlrd                  2.0.1
lmcinnes commented 1 year ago

This seems odd, as if it is circular dependencies it should consistently fail on any platform. I can't see anything obvious that would cause this.

cccxg commented 1 year ago

I'm using Python 3.11.2. Could this have made a difference?

lmcinnes commented 1 year ago

It is possible. I'm not aware of any changes that should have this kind of impact. I'll see if I can reproduce this at all.