Skip to content
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

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

Open
dsm-72 opened this issue May 26, 2023 · 5 comments

Comments

@dsm-72
Copy link
Contributor

dsm-72 commented May 26, 2023

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
Copy link
Contributor Author

dsm-72 commented Apr 8, 2024

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

@dsm-72
Copy link
Contributor Author

dsm-72 commented Apr 28, 2024

@Hoeze @davidsebfischer, bump on this?

@zyll123
Copy link

zyll123 commented Jun 3, 2024

is there any solutions?

@dsm-72
Copy link
Contributor Author

dsm-72 commented Jun 3, 2024

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

@zyll123
Copy link

zyll123 commented Jun 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants