ralhei / pyRserve

A python client for Rserve (network layer to remote R server)
Other
48 stars 13 forks source link

issue when importing pyRserve with numpy >= 2.0 #34

Open pierrequiroulenamassepasmousse opened 2 days ago

pierrequiroulenamassepasmousse commented 2 days ago

I'm facing the following issue when importing rtypes with a version of numpy superior to 2.0. "AttributeError: np.string_ was removed in the NumPy 2.0 release. Use np.bytes_ instead". Is there a quick fix to that aside from downgrading to an older version of numpy ? Thanks

ralhei commented 1 day ago

No very fast quick fix right now, besides using a numpy version < 2.0 But I am aware of this problem, just haven't managed to take care of it. Will hopefully manage to do so in the next 8 days. R

pierrequiroulenamassepasmousse commented 1 day ago

Many thanks for your answer and that you'll work on a fix. In the meanwhile, I found a way to at least load pyRserve and use it in a certain extent to be able to continue my developments. I added the following code after importing numpy. " if np.version >= "2.0.0": np.string = np.bytes # for numpy >= 2.0 setattr(np, 'compat', type('compat', (), {})) # Create a 'compat' namespace in numpy np.compat.long = int # built-in int supports arbitrarily large integers np.unicode = np.str " It doesn't seem to create problems for the current use I'm having of the package. Thanks for the great package by the way! It kind of saved my life and avoided me rewriting my R data.table code in highly non-efficient and verbose python panda code :)