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

AttributeError: numpy module has no attribute 'warnings' when encountering All-NaN slice/axis #704

Closed
junweizeng opened this issue Apr 27, 2024 · 1 comment

Comments

@junweizeng
Copy link

Hi all,

I encountered an issue while using the kmeans_plusplus_initializer function in the pyclustering.cluster.center_initializer module. The error message is as follows:

AttributeError: module 'numpy' has no attribute 'warnings'

The real cause of this error is in the following location of pyclustering 0.10.1.2:

numpy.warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')

This error occurs seems that because the numpy.warnings module has been removed in recent versions of numpy, and the warnings module from Python's standard library should be used instead.

I was able to resolve this issue by modifying the source code in center_initializer.py. I replaced numpy.warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered') with warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered').

If this is indeed an issue, I would be happy to submit a PR to fix this bug. Please let me know if you would like me to proceed with this.

@junweizeng
Copy link
Author

junweizeng commented Apr 27, 2024

I found a PR (#697) that can fix this bug.

And this issue is a dup of #696.

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