scikit-learn-contrib / hdbscan

A high performance implementation of HDBSCAN clustering.
http://hdbscan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
2.81k stars 507 forks source link

Test problems using python -m nose -s hdbscan #652

Open xavgit opened 3 months ago

xavgit commented 3 months ago

Hi, I have installed hdbscan with pip without any errors: ........................................................................................... Installing collected packages: hdbscan Attempting uninstall: hdbscan Found existing installation: hdbscan 0.8.37 Uninstalling hdbscan-0.8.37: Successfully uninstalled hdbscan-0.8.37 Successfully installed hdbscan-0.8.38.post1

When I run the following I receive errors.

python3 -m nose -s hdbscan Exception ignored on calling ctypes callback function: <function _ThreadpoolInfo._find_modules_with_dl_iterate_phdr..match_module_callback at 0x7fa138d46f70> Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 400, in match_module_callback self._make_module_from_path(filepath) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 515, in _make_module_from_path module = module_class(filepath, prefix, user_api, internal_api) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 606, in init self.version = self.get_version() File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 646, in get_version config = get_config().split() AttributeError: 'NoneType' object has no attribute 'split' ..E..................E............................../home/xxxx/.local/lib/python3.8/site-packages/hdbscan/tests/test_hdbscan.py:80: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning). Consider using matplotlib.pyplot.close(). plt.figure() Exception ignored on calling ctypes callback function: <function _ThreadpoolInfo._find_modules_with_dl_iterate_phdr..match_module_callback at 0x7fa114b849d0> Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 400, in match_module_callback self._make_module_from_path(filepath) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 515, in _make_module_from_path module = module_class(filepath, prefix, user_api, internal_api) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 606, in init self.version = self.get_version() File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 646, in get_version config = get_config().split() AttributeError: 'NoneType' object has no attribute 'split' Exception ignored on calling ctypes callback function: <function _ThreadpoolInfo._find_modules_with_dl_iterate_phdr..match_module_callback at 0x7fa11435daf0> Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 400, in match_module_callback self._make_module_from_path(filepath) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 515, in _make_module_from_path module = module_class(filepath, prefix, user_api, internal_api) File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 606, in init self.version = self.get_version() File "/home/xxxx/.local/lib/python3.8/site-packages/threadpoolctl.py", line 646, in get_version config = get_config().split() AttributeError: 'NoneType' object has no attribute 'split' ..............EE..........E

ERROR: Check warning on unsupported metric.

Traceback (most recent call last): File "sklearn/metrics/_dist_metrics.pyx", line 420, in sklearn.metrics._dist_metrics.DistanceMetric64.get_metric KeyError: 'cosine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/tests/test_branches.py", line 147, in test_branch_detection_data_with_non_treemetric c = HDBSCAN( File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/hdbscan.py", line 1221, in fit ) = hdbscan(cleandata, **kwargs) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/hdbscan.py", line 869, in hdbscan (single_linkage_tree, result_min_spantree) = memory.cache( File "/home/xxxx/.local/lib/python3.8/site-packages/joblib/memory.py", line 349, in call return self.func(*args, **kwargs) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/hdbscan.py", line 384, in _hdbscan_boruvka_balltree tree = BallTree(X, metric=metric, leaf_size=leaf_size, **kwargs) File "sklearn/neighbors/_binary_tree.pxi", line 837, in sklearn.neighbors._ball_tree.BinaryTree.init File "sklearn/metrics/_dist_metrics.pyx", line 211, in sklearn.metrics._dist_metrics.DistanceMetric.get_metric File "sklearn/metrics/_dist_metrics.pyx", line 422, in sklearn.metrics._dist_metrics.DistanceMetric64.get_metric ValueError: Unrecognized metric 'cosine'

====================================================================== ERROR: hdbscan.tests.test_branches.test_branch_detector_is_sklearn_estimator

Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/tests/test_branches.py", line 473, in test_branch_detector_is_sklearn_estimator check_estimator(BranchDetector) File "/home/xxxx/.local/lib/python3.8/site-packages/sklearn/utils/estimator_checks.py", line 616, in check_estimator raise TypeError(msg) TypeError: Passing a class was deprecated in version 0.23 and isn't supported anymore from 0.24.Please pass an instance instead.

====================================================================== ERROR: hdbscan.tests.test_hdbscan.test_hdbscan_is_sklearn_estimator

Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/tests/test_hdbscan.py", line 654, in test_hdbscan_is_sklearn_estimator check_estimator(HDBSCAN) File "/home/xxxx/.local/lib/python3.8/site-packages/sklearn/utils/estimator_checks.py", line 616, in check_estimator raise TypeError(msg) TypeError: Passing a class was deprecated in version 0.23 and isn't supported anymore from 0.24.Please pass an instance instead.

====================================================================== ERROR: hdbscan.tests.test_prediction_utils.test_safe_always_positive_division

Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) TypeError: test_safe_always_positive_division() missing 1 required positional argument: 'denominator'

====================================================================== ERROR: hdbscan.tests.test_rsl.test_rsl_is_sklearn_estimator

Traceback (most recent call last): File "/home/xxxx/.local/lib/python3.8/site-packages/nose/case.py", line 198, in runTest self.test(*self.arg) File "/home/xxxx/.local/lib/python3.8/site-packages/hdbscan/tests/test_rsl.py", line 197, in test_rsl_is_sklearn_estimator check_estimator(RobustSingleLinkage) File "/home/xxxx/.local/lib/python3.8/site-packages/sklearn/utils/estimator_checks.py", line 616, in check_estimator raise TypeError(msg) TypeError: Passing a class was deprecated in version 0.23 and isn't supported anymore from 0.24.Please pass an instance instead.


Ran 79 tests in 13.621s

FAILED (errors=5)

Thanks. Saverio

xavgit commented 3 months ago

The previous errors with Ubuntu 20.04.

With Ubuntu 22.04 instead:

python3 -m nose -s hdbscan Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/main.py", line 8, in run_exit() File "/home/xxxx/.local/lib/python3.10/site-packages/nose/core.py", line 118, in init unittest.TestProgram.init( File "/usr/lib/python3.10/unittest/main.py", line 100, in init self.parseArgs(argv) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/core.py", line 179, in parseArgs self.createTests() File "/home/xxxx/.local/lib/python3.10/site-packages/nose/core.py", line 193, in createTests self.test = self.testLoader.loadTestsFromNames(self.testNames) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 481, in loadTestsFromNames return unittest.TestLoader.loadTestsFromNames(self, names, module) File "/usr/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python3.10/unittest/loader.py", line 220, in suites = [self.loadTestsFromName(name, module) for name in names] File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 431, in loadTestsFromName return self.loadTestsFromModule( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 354, in loadTestsFromModule tests.extend(self.loadTestsFromDir(module_path)) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 191, in loadTestsFromDir yield self.loadTestsFromName( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 431, in loadTestsFromName return self.loadTestsFromModule( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 354, in loadTestsFromModule tests.extend(self.loadTestsFromDir(module_path)) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 183, in loadTestsFromDir yield self.loadTestsFromName( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 431, in loadTestsFromName return self.loadTestsFromModule( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/loader.py", line 359, in loadTestsFromModule return self.suiteClass(ContextList(tests, context=module)) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/suite.py", line 428, in call return self.makeSuite(tests, context, **kw) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/suite.py", line 475, in makeSuite suite = self.suiteClass( File "/home/xxxx/.local/lib/python3.10/site-packages/nose/suite.py", line 159, in init super(ContextSuite, self).init(tests) File "/home/xxxx/.local/lib/python3.10/site-packages/nose/suite.py", line 53, in init super(LazySuite, self).init() File "/usr/lib/python3.10/unittest/suite.py", line 22, in init self._tests = [] File "/home/xxxx/.local/lib/python3.10/site-packages/nose/suite.py", line 106, in _set_tests if isinstance(tests, collections.Callable) and not is_suite: AttributeError: module 'collections' has no attribute 'Callable'

Where I'm wrong?

Thanks.

Saverio