JiekaiLab / scDIOR

scDIOR: Single cell data IO softwaRe
GNU General Public License v3.0
131 stars 11 forks source link

diopy.input.read_h5 bug #20

Open Famingzhao opened 1 year ago

Famingzhao commented 1 year ago

adata=diopy.input.read_h5( file = "adata.h5")

Error: 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


UnboundLocalError Traceback (most recent call last) Cell In[7], line 1 ----> 1 adata=diopy.input.read_h5( file = "adata.h5")

File ~/.local/lib/python3.8/site-packages/diopy/input.py:58, in read_h5(file, assay_name) 56 finally: 57 h5.close() ---> 58 return adata

UnboundLocalError: local variable 'adata' referenced before assignment

HJ234 commented 1 year ago

Hi I had the same problem. I remade my conda environment with the following and installed diopy. I'm not sure which program is causing the issue (possibly numpy), but it worked. python(3.8.16), matplotlib(3.7.1), numpy(1.23.4), pandas(1.5.3), scipy(1.10.1), scanpy(1.9.3)

cathalgking commented 1 year ago

I still get this error, even after using the conda environment as described by @HJ234 did you follow these steps?

conda create -n diopy2 python=3.8.16 matplotlib=3.7.1 numpy=1.23.4 pandas=1.5.3 scipy=1.10.1
conda activate diopy2
pip install scanpy
import diopy
adata = diopy.input.read_h5(file = '/PATH/scdata.h5')

UnboundLocalError: local variable 'adata' referenced before assignment

realzehuali commented 1 year ago

same error

LenisLin commented 10 months ago

@fenghuijian could you provide ant advice ? thanks in advanced

Yanst86 commented 10 months ago

Hi, same issue here, I get both the error of the OP as well as the 'UnboundLocalError: local variable 'adata' referenced before assignment' . Any suggestions how to fix that?

zhangdae commented 7 months ago

I`ve solved thee problem by edit the code named input.py of diopy.Change np.object and np.bool to object and bool.

zhangdae commented 7 months ago

Hi, same issue here, I get both the error of the OP as well as the 'UnboundLocalError: local variable 'adata' referenced before assignment' . Any suggestions how to fix that?

see my new comment

zhangdae commented 7 months ago

Hi I had the same problem. I remade my conda environment with the following and installed diopy. I'm not sure which program is causing the issue (possibly numpy), but it worked. python(3.8.16), matplotlib(3.7.1), numpy(1.23.4), pandas(1.5.3), scipy(1.10.1), scanpy(1.9.3)

#

I`ve solved thee problem by edit the code named input.py of diopy.Change np.object and np.bool to object and bool.

orange511 commented 3 months ago

I`ve solved thee problem by edit the code named input.py of diopy.Change np.object and np.bool to object and bool.

"After making the changes based on your advice, it still throws an error."

zhangdae commented 3 months ago

I`ve solved thee problem by edit the code named input.py of diopy.Change np.object and np.bool to object and bool.

"After making the changes based on your advice, it still throws an error."

My problem was the confilct between local variable and global variable,it actually caused by the old version code of numpy in diopy's source code.So I changed the code based on the error reports,it show which line caused such error.Maybe we are not the same.