pySCENIC
pySCENIC copied to clipboard
ERROR: module 'numpy' has no attribute 'object'
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.objectwill 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.objectwas a deprecated alias for the builtinobject. To avoid this error in existing code, useobjectby 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.objectwill 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.objectwas a deprecated alias for the builtinobject. To avoid this error in existing code, useobjectby 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
Problem solved by rebuilding a conda environment build fr python 3.8 with numpy 1.24.4.
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.
See: https://github.com/aertslab/pySCENIC/issues/579#issuecomment-2405207860