scikit-hubness icon indicating copy to clipboard operation
scikit-hubness copied to clipboard

Does not work with latest numpy

Open clkruse opened this issue 2 years ago • 8 comments

It throws the following error when trying to import the skhubness package. AttributeError: module 'numpy' has no attribute 'float'

The float attribute seems to have been removed in numpy 1.24, so I resolved this by downgrading to numpy==1.23.

clkruse avatar Mar 22 '23 16:03 clkruse

Thanks for reporting this. Indeed, the numpy aliases to Python dtypes have been removed in 1.24, ref. For the time being skhubness thus requires numpy<1.24.

VarIr avatar Mar 22 '23 18:03 VarIr

Is this package still being developed?

jolespin avatar May 20 '24 07:05 jolespin

Not very actively, though I might find some time to do maintenance tasks like this (which likely only requires changing np.float to np.float32 in the code; PR welcome).

VarIr avatar May 21 '24 07:05 VarIr

This package would be extremely useful for my research as I've been trying to implement some of these methods myself but I don't really have the background for it.

I can take a crack at updating the code to use the newest numpy and scikit learn because I'm unable to install this with pip.

Is there anything in particular I should be aware of in terms of porting to the newest versions?

jolespin avatar May 21 '24 15:05 jolespin

@jolespin Thank you, but now I believe this is in fact not necessary:

I have just tested skhubness==0.30 with Python=3.10 and recent numpy, sklearn etc. This runs the example code from the readme just fine. Also, at a quick glance, I could not find any usage of np.float in the code base that would have caused the initial error reported here. So I suppose this error came from an earlier version of skhubness (v.20.x indeed used np.float).

VarIr avatar May 22 '24 07:05 VarIr

Awesome. A few hours ago I forked it and got it to install just fine from source. I just changed a single line in the test directory under the neighbor module.

Is the 0.30 version ready for public by any chance? Maybe under beta release?

jolespin avatar May 22 '24 07:05 jolespin

Thx for the feedback. Which line did you change?

It is ready enough that I pushed the changes to main. Since the docs are not yet fully updated to reflect changes in v.30, I've never created an "official" release for PyPI. I cannot guarantee for anything, but please feel free to try and test.

VarIr avatar May 22 '24 07:05 VarIr

I just remove the np.float32 and np.float64 parts but I didn't even need to since I was already working with v0.30a.

jolespin avatar May 22 '24 19:05 jolespin