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

ERROR: module 'numpy' has no attribute 'object' #578

Open
xyang2uchicago opened this issue Sep 17, 2024 · 3 comments
Open

ERROR: module 'numpy' has no attribute 'object' #578

xyang2uchicago opened this issue Sep 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@xyang2uchicago
Copy link

module 'numpy' has no attribute 'object'
I install pyscenic under my conda environment of Python 3.11.7

pip install cytoolz
pip install pyscenic

Then, I followed the tutorial at https://pyscenic.readthedocs.io/en/latest/tutorial.html
step by step.

The error cam when I called:

from pyscenic.prune import prune2df, df2regulons
/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/pyscenic/transform.py:42: FutureWarning: In the future np.object will be defined as the corresponding NumPy scalar.
("Enrichment", COLUMN_NAME_ANNOTATION): np.object,
Traceback (most recent call last):
File "", line 1, in
File "/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/pyscenic/prune.py", line 27, in
from .transform import (
File "/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/pyscenic/transform.py", line 42, in
("Enrichment", COLUMN_NAME_ANNOTATION): np.object,
^^^^^^^^^
File "/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/numpy/init.py", line 324, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'object'.
np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe.
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. Did you mean: 'object_'?

Similarly, when I try to follow the notebook at https://github.com/aertslab/SCENICprotocol/blob/master/notebooks/SCENIC%20Protocol%20-%20Case%20study%20-%20Mouse%20brain%20data%20set.ipynb
The similar error came at:

from pyscenic.transform import df2regulons
/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/pyscenic/transform.py:42: FutureWarning: In the future np.object will be defined as the corresponding NumPy scalar.
("Enrichment", COLUMN_NAME_ANNOTATION): np.object,
Traceback (most recent call last):
File "", line 1, in
File "/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/pyscenic/transform.py", line 42, in
("Enrichment", COLUMN_NAME_ANNOTATION): np.object,
^^^^^^^^^
File "/project/xyang2/software-packages/env/velocity_2022.05_xy/lib/python3.11/site-packages/numpy/init.py", line 324, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'object'.
np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe.
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. Did you mean: 'object_'?

The package versions are:

version('pandas')
'2.2.0'
version('numpy')
'1.26.3'
version('cytoolz')
'0.12.3'
version('pyscenic')
'0.12.1'

Thank you for suggestions.
Holly

@xyang2uchicago xyang2uchicago added the bug Something isn't working label Sep 17, 2024
@xyang2uchicago
Copy link
Author

Problem solved by rebuilding a conda environment build fr python 3.8 with numpy 1.24.4.

@anyang-kevin
Copy link

Problem solved by rebuilding a conda environment build fr python 3.8 with numpy 1.24.4.

It's not useful. Numpy deleted np.object in 1.20. The only way right now is change the code in pyscenic/transform.py. Change all np.object to object can call out the help page.

@ghuls
Copy link
Member

ghuls commented Oct 10, 2024

See: #579 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants