Streamlit can't pull from repo if git attributes file exists, once deleted, streamlit doesn't get reference to git LFS file

I’m using git lfs to store a pickled model. Streamlit wouldn’t pull properly when the git attributes file existed. I deleted it and got much further in my deployment, then ran into the problem of not being able to load my pickle and I suspect it’s because the git attributes file is gone. I read through some threads and streamlit supports git lfs now. Not sure how to proceed. Error I get when trying to load the pickle and don’t have the git attributes file:

2021-04-14 23:03:25.805 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/", line 333, in _run_script

    exec(code, module.__dict__)

  File "/app/nlp/", line 487, in <module>

    svm_fasttext_model = pickle.load(f)

_pickle.UnpicklingError: invalid load key, 'v'.

Hi @anurag8517, welcome to the Streamlit community!

From my experience, pickle errors are usually due to a mismatch between the Python version used to create the file and what Streamlit sharing is using (3.7). What version of Python are you using locally?


1 Like

Hi Randy. Thank you for your quick response. I’m in fact using 3.8
I was about to re pickle, but this is the second pickle of the code and it only breaks on the second one. I suspect that it has something to do with the fact that it’s using LFS, but definitely not certain.

Have a good day.

I’d start with the pickle hypothesis. People seem to be having success with LFS, or at least, I haven’t heard of any other issues where people’s apps aren’t deploying.


Used python 3.7 to pickle and I’m still getting the same error. Same thing with the .gitattributes file as well. The first pickle model is loading fine so I’m guessing it’s something to do with the git LFS. Without the git attributes file, does the large file have a pointer to where it’s stored?

Thank you

Hi Randy. I’ve managed to host my pickle on google drive. I’m now getting the following error:
could not extract any ngrams from ’ ', returning origin vector
Everything is working when I run it on my local machine using the input() function. Is it possible the following statement is causing an error? words = st.text_input()