Error occurs when loading a pickle file

Hi,
Thanks to streamlit I created a web-page creating a graph.
So, my page would draw a graph based from the data that I have uploaded.

The problem is that I used to load a pickle file(which is pretty big, 1.05GB in total) and worked fine until few days ago.
I randomly found out that an error occurred and could not load the pickle file.

The code and loading of the pickle file works fine locally, so I thought the problem would either be from streamlit or github lfs.

I have tried to reduce the size of the pickle file to total of (400MB).
But still did not work.
Below is the error that I got.

34 │   │   file_path = 'pickle_file_path.pkl'             
35 │   │   with open(file_path, 'rb') as f:
36 │   │        adata = pickle.load(f)         <-- **ERROR**
  /home/adminuser/venv/lib/python3.9/site-packages/anndata/_core/file_backing.  
  py:45 in __setstate__                                                                                                                                         
     42 │                                                                       
     43 │   def __setstate__(self, state):                                      
     44 │   │   self.__dict__ = state.copy()                                    
  ❱  45 │   │   self.__dict__["_adata_ref"] = weakref.ref(state["_adata_ref"])  
     46 │                                                                       
     47 │   @property                                                           
     48 │   def _adata(self):                                                   
────────────────────────────────────────────────────────────────────────────────
KeyError: '_adata_ref'

The error occurs on when loading the pickle file adata=pickle.load(f).
Could anybody help this out?

Hi,
Did you try to create another pickle to see if it’s not corrupted ?

Yes, I added a different test pickle file and there was no trouble loading it.
And for the data pickle file I previously used, it loads perfectly fine in local environment.

Hi, this issue should be caused by the mismatch version of anndata. I meet this error when using anndata==0.10.9, and downgrading it to 0.10.8 helps me address it.