-1

I am getting the following errors when trying to run a cloned repo of localGPT on my mac. I have successfully installed everything in the requirements.txt file.

This is happening with multiple python repos and other imports. Is this a path issue? How might I fix those.

Traceback (most recent call last):
  File "/Documents/GitHub/localGPT/ingest.py", line 12, in <module>
    from constants import (CHROMA_SETTINGS, DOCUMENT_MAP, EMBEDDING_MODEL_NAME, INGEST_THREADS, PERSIST_DIRECTORY,
  File "/Documents/GitHub/localGPT/constants.py", line 7, in <module>
    from langchain.document_loaders import (
ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders' (/anaconda3/lib/python3.10/site-packages/langchain/document_loaders/__init__.py)

I have run this in Coda, through the terminal app, and in VS Code.

starball
  • 20,030
  • 7
  • 43
  • 238
Scott B
  • 3
  • 4

1 Answers1

1

Googling ""cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders'"", I found Closed ImportError: cannot import name 'UnstructuredExcelLoader' from 'langchain.document_loaders' #113. Quoting from a comment by @ashokrs there:

The UnstructuredExcelLoader module was removed from one of the earlier versions of the langchain library. Sorry, I don't know which one specifically. If you are using an older version of the library, you will need to upgrade to a newer version in order to use the UnstructuredExcelLoader module.

Not only this error you had come across so far, You may need to carefully run "pip install -r requirements.txt" to update many python libraries to factor in all the changes since your recent pull. Please see that the "requirements.txt" is also changed yesterday.

I believe you can upgrade using pip install langchain --upgrade. For some reason, @ashokrs suggested instead to do pip uninstall langchain and then pip install langchain. I'm not sure what the difference is. See also How can I upgrade specific packages using pip and a requirements file?.

starball
  • 20,030
  • 7
  • 43
  • 238
  • Uninstalling worked. Also helped to specify the python version when setting up the conda environment `conda create --name local-gpt python=3.11.3 ` – Scott B Jun 15 '23 at 18:32