-
Notifications
You must be signed in to change notification settings - Fork 507
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
pypi version throws ValueError #607
Comments
I have the same error, both the 0.8.29 and 0.8.33 |
Absolutely, my version of python is also 3.11.x. I have the same error, but after I try this method, I get anthor error Try |
Maybe #606 helps with this error. |
I also replicated the bug on Windows. Packages installed with pypi. Base virtual environment created with miniconda. Bug occurs:
from sklearn.datasets import make_blobs
import hdbscan
blobs, labels = make_blobs(n_samples=2000, n_features=10)
clusterer = hdbscan.HDBSCAN()
clusterer.fit(blobs)
print(clusterer.labels_) Error: File hdbscan\\_hdbscan_tree.pyx:733, in hdbscan._hdbscan_tree.get_clusters()
TypeError: 'numpy.float64' object cannot be interpreted as an integer Avoid the bug by switching to slower Python 3.10.x and downgrading scikit-learn. Keep the hdbscan and numpy versions. No errors:
Revised 15 August, 2023 |
I am also getting this error on windows builds. This seems like a pretty urgent issue. @lmcinnes or @gclendenning, forgive the @, but you may want to take a look at this. |
So this line:
and stability is from https://github.com/scikit-learn-contrib/hdbscan/blob/master/hdbscan/_hdbscan_tree.pyx#L164, see return https://github.com/scikit-learn-contrib/hdbscan/blob/master/hdbscan/_hdbscan_tree.pyx#L237-L241
I am not sure if the |
@jkmackie thanks for the solution mate! appreciate it. |
At least some of the issues seem to be related to the wheel built for windows (and python 3.11). I have deleted that from PyPI. The downside is that installing on windows will require you to build from source; the upside is that hopefully installing from PyPI might work now. |
Just to confirm, I am also seeing this on an Ubuntu 22.04 CI with:
|
not sure if those being floats is the problem here |
@johnlees I suspect downgrading scikit-learn below 1.3 would fix on Ubuntu. Numpy 1.22.4 is used in the successful Windows configuration below: #Successful configuration - Windows 10.
(myvirtualenv)
me@mypc MINGW64 ~/embedding_clustering
$ conda list | grep -w '^python\s\|scikit\|hdbscan\|numpy'
hdbscan 0.8.33 pypi_0 pypi
numpy 1.24.4 pypi_0 pypi
python 3.10.9 h4de0772_0_cpython conda-forge
scikit-learn 1.2.1 pypi_0 pypi Note hdbscan is imported separately from scikit-learn. I wonder why it isn't imported as a module like KMeans? #from package.subpackage import module
from sklearn.cluster import KMeans
#in contrast, hdbscan cluster algo is imported directly
import hdbscan |
Same issue with scikit-learn 1.2.2 and 1.2.1, and other packages as above. |
This is really quirky, and I am having a great deal of trouble reproducing it in a way that I can actually debug it myself. |
Removing the pre-built wheel for windows on pypi was sufficient to get it working on my github actions windows runners. If it is helpful, here is an example of when it was failing: https://github.com/RichieHakim/ROICaT/actions/runs/5861440405/job/15891513454 Thank you for the quick fix. |
Removing the pre-built wheels and building from source didn't solve the bug for me |
Did you try a fresh environment? conda create -n testenv python=3.11
pip install hdbscan==0.8.33 numpy==1.24.4 notebook==7.0.2 scikit-learn==1.3.0 Cython should be something like 0.29.26 not 3.0. If there's a hdbscan error, try: pip install --upgrade git+https://github.com/scikit-learn-contrib/hdbscan.git#egg=hdbscan |
Likewise – doing the install from source (rebuilding the cython generated .so libraries) makes the issue go away. I have floats in the line reported by the backtrace, and am not sure that's the correct erroring line anyway. I might try rebuilding the conda-forge version and see if that helps |
We have a new azure-pipelines CI system that will automatically build wheels and publish them to PyPI thanks to @gclendenning, so hopefully the next time we make a release this will all work a little better. It is definitely just quirks on exactly how things build on different platforms etc. but the fine details of that are ... hard to sort out. |
Ah maybe I should have been clearer, I am having issues with the conda version, not pypi. |
The conda forge recipe might need to be changed. Potentially adding a version restriction to Cython in the recipe itself (since it may not use the build isolation that pip install does) might help. |
Thanks for the pointer, this seems to have fixed it! Looks like we can have cython<3 when built but free version at run time and it works. I also added a run test to the recipe which I hope would flag such an issue in future releases |
Hi all, having trouble understanding what to do here (I installed HDBSCAN 2 days ago through Conda and I'm currently experiencing this issue). Can I remove and reinstall HDBSCAN through Conda at this point to solve the problem? If so, do I also need to remove and reinstall anything else? Cython? Thank you. |
@Gr4dient I would reinstall your HDBSCAN in that environment, or even just try a fresh conda environment. I hope to have fixed it in 0.8.33_3 releases (when you do |
Hi John, thanks for clarifying - it took several hours for Conda to find a solution to remove Cython and HDBSCAN from my NLP environment last night... not sure why it got so hung up. I'm not seeing '_3' on conda-forge; will that be available at some point soon? Thanks |
The new builds are on conda forge, e.g. in my working environment
If you are having trouble with time taken to resolve environments I would recommend using mamba instead of conda, or just starting over with a new environment, or both. |
I can also reproduce this with a from-source build on Fedora 39:
A hacky fix which works for me is to replace https://github.com/scikit-learn-contrib/hdbscan/blob/0.8.33/hdbscan/_hdbscan_tree.pyx#L726-L729 with
|
To reproduce the bug:
Workaround:
python setup.py install
while the environment is activeThis was also tested with the commit 813636b (The commit of version 0.8.33)
Would be nice to get instructions on how to fix this (if the error is on my side) or to fix this in general.
Tested on Windows and Linux. This error only occurs under python 3.11.x.
The text was updated successfully, but these errors were encountered: