theislab / diffxpy

Differential expression analysis for single-cell RNA-seq data.
https://diffxpy.rtfd.io
BSD 3-Clause "New" or "Revised" License
191 stars 23 forks source link

`np.float` deprecation raises AttributeError: module 'numpy' has no attribute 'float'. #224

Open dsm-72 opened 1 year ago

dsm-72 commented 1 year ago
test = de.test.pairwise(
    data=adata,
    grouping='group_label',
    test='t-test',
    lazy=False,
    noise_model=None,
    keep_full_test_objs=True
)

yields

File [~/mambaforge/envs/ENV/lib/python3.10/site-packages/diffxpy/testing/det.py:1567](https://file+.vscode-resource.vscode-cdn.net/Users/USER/Projects/PROJECT/examples/~/mambaforge/envs/ENV/lib/python3.10/site-packages/diffxpy/testing/det.py:1567), in DifferentialExpressionTestTT.__init__(self, data, sample_description, grouping, gene_names, is_logged, is_sig_zerovar)
   1564 x0, x1 = split_x(data, grouping)
   1566 # Only compute p-values for genes with non-zero observations and non-zero group-wise variance.
-> 1567 mean_x0 = np.asarray(np.mean(x0, axis=0)).flatten().astype(dtype=np.float)
   1568 mean_x1 = np.asarray(np.mean(x1, axis=0)).flatten().astype(dtype=np.float)
   1569 # Avoid unnecessary mean computation:

File [~/mambaforge/envs/ENV/lib/python3.10/site-packages/numpy/__init__.py:305](https://file+.vscode-resource.vscode-cdn.net/Users/USER/Projects/PROJECT/examples/~/mambaforge/envs/ENV/lib/python3.10/site-packages/numpy/__init__.py:305), in __getattr__(attr)
    300     warnings.warn(
    301         f"In the future `np.{attr}` will be defined as the "
    302         "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
    304 if attr in __former_attrs__:
--> 305     raise AttributeError(__former_attrs__[attr])
    307 # Importing Tester requires importing all of UnitTest which is not a
    308 # cheap import Since it is mainly used in test suits, we lazy import it
    309 # here to save on the order of 10 ms of import time for most users
    310 #
    311 # The previous way Tester was imported also had a side effect of adding
    312 # the full `numpy.testing` namespace
    313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` 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
dsm-72 commented 5 months ago

Since this got merged in can this actually be a release on pypi / conda @gokceneraslan

dsm-72 commented 5 months ago

@Hoeze @davidsebfischer, bump on this?

zyll123 commented 3 months ago

is there any solutions?

dsm-72 commented 3 months ago

@zyll123 @davidsebfischer @Hoeze yes, install from main branch, or have maintainers release new version

zyll123 commented 3 months ago

sorry, I am new to github. Could you please tell me how to install your modified version? TAT