1

When I try to load a pickle file onto Google Colab like this:

with open("file.pkl", "rb") as f:
        vectorstore = pickle.load(f)

I either get:

AttributeError: Can't get attribute 'Document' on <module 'langchain.schema' from '/usr/local/lib/python3.9/dist-packages/langchain/schema.py'>

or

ImportError: cannot import name 'Document' from 'langchain.schema' (/usr/local/lib/python3.9/dist-packages/langchain/schema.py)

Reinstalling Langchain and other workarounds did not fix the issue. The .pkl file is already in my "files" tab, so it's not an issue with importation

toot83
  • 11
  • 2
  • Does this answer your question? [Accessing '.pickle' file in Google Colab](https://stackoverflow.com/questions/49206488/accessing-pickle-file-in-google-colab) – Marcelo Paco Apr 04 '23 at 17:06

1 Answers1

0

I had the same error and recreating the pkl file solved it. If you updated your environment after creating the pkl file it's likely a problem with different versions of a module (I couldn't spot which in my case)

saccodd
  • 972
  • 9
  • 23