aertslab / pySCENIC

pySCENIC is a lightning-fast python implementation of the SCENIC pipeline (Single-Cell rEgulatory Network Inference and Clustering) which enables biologists to infer transcription factors, gene regulatory networks and cell types from single-cell RNA-seq data.
http://scenic.aertslab.org
GNU General Public License v3.0
420 stars 179 forks source link

[BUG] AttributeError: module 'numpy' has no attribute 'float'. #543

Open juniajvs opened 4 months ago

juniajvs commented 4 months ago

Hello all,

thanks for the great package. I am having issues running the aucell part of your tutorial more specifically line 45:

!pyscenic aucell \ {f_loom_path_scenic} \ reg.csv \ --output {f_pyscenic_output} \ --num_workers 20

This is the output message including the error message that comes up:

2024-05-03 11:00:17,453 - pyscenic.cli.pyscenic - INFO - Loading expression matrix.

2024-05-03 11:00:19,938 - pyscenic.cli.pyscenic - INFO - Loading gene signatures. Create regulons from a dataframe of enriched features. Additional columns saved: []

2024-05-03 11:00:20,114 - pyscenic.cli.pyscenic - INFO - Calculating cellular enrichment.

2024-05-03 11:01:04,264 - pyscenic.cli.pyscenic - INFO - Writing results to file. multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar return list(itertools.starmap(args[0], args[1])) File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/site-packages/pyscenic/binarization.py", line 56, in derivethreshold if not isbimodal(data, method): File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/site-packages/pyscenic/binarization.py", line 43, in isbimodal , pval, _ = diptst(np.msort(data)) File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/site-packages/pyscenic/diptest.py", line 64, in diptst else (np.less(d, unif_dips).sum() + 1) / (np.float(numt) + 1) File "/data1/software/miniconda/envs/pyscenic/lib/python3.10/site-packages/numpy/init.py", line 324, in getattr raise AttributeError(__former_attrs__[attr]) ... 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 Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

The source code needs to be modified to accommodate the changes in NumPy.

Best, Junia

ksarieva commented 4 months ago

I am not a developer. What helped me to overcome the same issue is to run pyscenic in docker like here https://pyscenic.readthedocs.io/en/stable/installation.html#:~:text=To%20run%20pySCENIC%20using%20Docker However, it doesn't solve the problem downstream, for example, with regulon specificity scores...

ghost commented 3 months ago

the same issue was found here.

somsomikim commented 3 months ago

Hi, I am also having the same issue here.

a896278896 commented 3 months ago

I solved the problem using the method in the link https://github.com/aertslab/pySCENIC/commit/31d51a1625f12fb3c6e92bc48ecc9d401524c22a

somsomikim commented 3 months ago

Hi, I have made changes following the link above, but I got a new error. Can you give any suggestions to solve this? The output messages and errors are below.

# 2024-06-21 14:27:11,624 - pyscenic.cli.pyscenic - INFO - Loading expression matrix. /home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/anndata/_core/anndata.py:1832: UserWarning: Variable names are not unique. To make them unique, call .var_names_make_unique. utils.warn_names_duplicates("var")

2024-06-21 14:27:12,546 - pyscenic.cli.pyscenic - INFO - Loading gene signatures. Create regulons from a dataframe of enriched features. Additional columns saved: []

2024-06-21 14:27:12,974 - pyscenic.cli.pyscenic - INFO - Calculating cellular enrichment.

2024-06-21 14:27:23,798 - pyscenic.cli.pyscenic - INFO - Writing results to file. Traceback (most recent call last): File "/home/smkim/.conda/envs/conda-pyscenic/bin/pyscenic", line 8, in sys.exit(main()) File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 721, in main args.func(args) File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/pyscenic/cli/pyscenic.py", line 304, in aucell_command append_auc_mtx( File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/pyscenic/cli/utils.py", line 374, in append_auc_mtx with lp.connect(fname, validate=False) as ds: File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/loompy/loompy.py", line 1515, in connect return LoomConnection(filename, mode, validate=validate) File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/loompy/loompy.py", line 96, in init self.ra = loompy.AttributeManager(self, axis=0) #: Row attributes, dict-like with np.ndarray values File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/loompy/attribute_manager.py", line 21, in init for key in self.ds._file[a].keys(): File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "/home/smkim/.conda/envs/conda-pyscenic/lib/python3.10/site-packages/h5py/_hl/group.py", line 357, in getitem oid = h5o.open(self.id, self._e(name), lapl=self._lapl) File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py/h5o.pyx", line 190, in h5py.h5o.open KeyError: "Unable to open object (object 'row_attrs' doesn't exist)"