LinkedInLearning / hands-on-ai-rag-using-llamaindex-3830207

This is a repository for the LinkedIn Learning course Hands-On AI: RAG using LlamaIndex
Other
12 stars 16 forks source link

Section 2 part 3 fails with Import not found. #1

Open MadVikingGod opened 1 month ago

MadVikingGod commented 1 month ago

Issue Overview

When Running Section 2.03 the current setup has errors creating documents. First I found that you are trying to load ./data not ../data, creating a directory not found error.

This uncovered a different error, that llama-index==0.10.37 needs llama-index-readers-file>=0.1.24 or it gets an import error.

Describe your environment

This was setup in codespaces using your setup script.

Steps to Reproduce

  1. Follow section 1 for setting up codespace
  2. Try to run section 2 part 3. Get error: ValueError: Directory ./data does not exist.
  3. Fix that error and run again and get
    
    ImportError                               Traceback (most recent call last)
    File /opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:52, in _try_loading_included_file_formats()
     [51](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:51) try:
    ---> [52](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:52)     from llama_index.readers.file import (
     [53](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:53)         DocxReader,
     [54](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:54)         EpubReader,
     [55](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:55)         HWPReader,
     [56](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:56)         ImageReader,
     [57](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:57)         IPYNBReader,
     [58](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:58)         MarkdownReader,
     [59](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:59)         MboxReader,
     [60](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:60)         PandasCSVReader,
     [61](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:61)         PandasExcelReader,
     [62](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:62)         PDFReader,
     [63](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:63)         PptxReader,
     [64](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:64)         VideoAudioReader,
     [65](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:65)     )  # pants: no-infer-dep
     [66](https://vscode-remote+codespaces-002bglowing-002dwaffle-002d647g4xjpjx36rv.vscode-resource.vscode-cdn.net/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/core/readers/file/base.py:66) except ImportError:

ImportError: cannot import name 'PandasExcelReader' from 'llama_index.readers.file' (/opt/conda/envs/lil_llama_index/lib/python3.10/site-packages/llama_index/readers/file/init.py)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) ... 89 ".xlsx": PandasExcelReader, 90 } 91 return default_file_reader_cls

ImportError: llama-index-readers-file package not found



## Possible Solution
<!-- Optional: Do you have a fix or a suggestion on how to fix the issue? -->
Fixing the `./data`, and doing a `pip install --upgrade llama-index-readers-file==0.1.25` + restart of the kernel fixes the issues
baubakg commented 5 days ago

The workaround works for me.