Open Famingzhao opened 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)
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
same error
@fenghuijian could you provide ant advice ? thanks in advanced
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?
I`ve solved thee problem by edit the code named input.py of diopy.Change np.object and np.bool to object and bool.
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
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.
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."
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.
Error: module 'numpy' has no attribute 'object'.
np.object
was a deprecated alias for the builtinobject
. To avoid this error in existing code, useobject
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#deprecationsUnboundLocalError 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