scverse / scvi-tools

Deep probabilistic analysis of single-cell and spatial omics data
http://scvi-tools.org/
BSD 3-Clause "New" or "Revised" License
1.16k stars 341 forks source link

AttributeError: module 'numpy' has no attribute 'str'. #2851

Closed klshen8386 closed 5 days ago

klshen8386 commented 5 days ago

seeing AttributeError: module 'numpy' has no attribute 'str'. when running code below (loading pbmc dataset)

adata = scvi.data.pbmc_dataset()
AttributeError: module 'numpy' has no attribute 'str'.
`np.str` was a deprecated alias for the builtin `str`. To avoid this error in existing code, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Versions:

0.20.3

martinkim0 commented 5 days ago

Hi, does the error replicate with scvi-tools >= 1.0.0? If you need 0.20.3 for reproducibility purposes, I would downgrade numpy to 1.20 or below.

klshen8386 commented 5 days ago

Hello, for dependency reasons I require scvi-tools < 1.0.0 > 0.16.0, however when I attempt to downgrade numpy below 1.20 (in this case, 1.19), I am receiving the error RuntimeError: Running cythonize failed! error: metadata-generation-failed

martinkim0 commented 5 days ago

Can you try numpy 1.23 instead? I believe np.str was removed in 1.24.

klshen8386 commented 5 days ago

Issue fixed - numpy 1.23 was compatible with scvi-tools 0.20.3. Thank you!