llama_index: Not able to use LLama Packs [Bug]:
Bug Description
I always get this error for any pack i download FileNotFoundError: [Errno 2] No such file or directory: ‘/content/chain_of_table_pack/llama_index/packs/tables/base.py’
Version
0.10.5
Steps to Reproduce
download_llama_pack( “ChainOfTablePack”, “./chain_of_table_pack”, )
Relevant Logs/Tracbacks
FileNotFoundError Traceback (most recent call last)
<ipython-input-6-da45d7f3ade5> in <cell line: 3>()
1 from llama_index.core.llama_pack import download_llama_pack
2
----> 3 download_llama_pack(
4 "ChainOfTablePack",
5 "./chain_of_table_pack",
4 frames
/usr/local/lib/python3.10/dist-packages/llama_index/core/llama_pack/download.py in download_llama_pack(llama_pack_class, download_dir, llama_pack_url, refresh_cache)
54 )
55 else:
---> 56 pack_cls = download_llama_pack_template(
57 new_install_parent=new_install_parent,
58 llama_pack_class=llama_pack_class,
/usr/local/lib/python3.10/dist-packages/llama_index/core/download/pack.py in download_llama_pack_template(new_install_parent, llama_pack_class, llama_pack_url, llama_pack_source_files_dir_path, refresh_cache, custom_dir, custom_path, base_file_name)
124
125 module = util.module_from_spec(spec)
--> 126 spec.loader.exec_module(module) # type: ignore
127
128 return getattr(module, llama_pack_class)
/usr/lib/python3.10/importlib/_bootstrap_external.py in exec_module(self, module)
/usr/lib/python3.10/importlib/_bootstrap_external.py in get_code(self, fullname)
/usr/lib/python3.10/importlib/_bootstrap_external.py in get_data(self, path)
FileNotFoundError: [Errno 2] No such file or directory:
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Comments: 15 (8 by maintainers)
🤖
Hey @jaideep11061982, back again diving into the deep end with Llama Packs, I see! Let’s tackle this head-on.
Based on the error logs you’ve provided, it seems like the issue is related to the file path of the pack you’re trying to download. The error
FileNotFoundError: [Errno 2] No such file or directory: '/content/chain_of_table_pack/llama_index/packs/tables/base.py'indicates that the file or directory you’re trying to access doesn’t exist.This could be due to a couple of reasons:
handle_download_llama_packfunction, thedownload_dirargument is used as the directory to download the pack into. If this directory does not exist, a FileNotFoundError could be raised.download_llama_packfunction, thellama_pack_classargument is used to specify the pack to download. If this pack does not exist, a FileNotFoundError could be raised.To resolve this issue, ensure that the directory you’re trying to download the pack into exists and that the pack you’re trying to download also exists. You can refer to the llama-index-cli/llama_index/cli/command_line.py for more details.
Also, there was a similar issue reported in the past, you can refer to this issue for more context.
Regarding the structure of the directory where the Llama Packs are supposed to be downloaded, it is not explicitly mentioned in the provided context. However, the directory can be specified by the user when downloading a Llama Pack. This is done using the
--download-dirargument in the CLI command or the second argument in thedownload_llama_packfunction in Python.CLI command:
Python code:
In both cases,
<pack_directory>should be replaced with the desired directory path. You can refer to the docs/community/llama_packs/root.md for more details.I hope this helps! If you have any more questions or need further clarification, feel free to ask.
Sources
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Hi @dian-R no worries. Okay, I think I got you. Actually what you have experienced is the expectation in v0.10.x.
In case you missed it, in the latest big release (v0.10.x) we’ve refactored the library by splitting it into “llama-index-core” and many integration packages. The idea being that you install “core” and only the other “integration” packages you need for your application. Now, to make things simpler for our users we’ve actually included
llama-index-coreplus other popular integration packages (likellama-index-llms-openai) in the main packagellama-index.In terms of
ChainOfTableQueryEngine, its packagellama-index-packs-tablesis not included inllama-index. This means, that in order to be able to import it and use it, you do have to pip install it. So, that’s why after you installed it via poetry (equivalently with pip) you were finally able to import it.Here’s another example for you to help drive home the changes in v0.10.x. If you want to use
HuggingFaceEmbeddings, you would need to installllama-index-embeddings-huggingfacepackage as well asllama-index.Here’s some more info on the release for you:
Hi @jaideep11061982, I just tried importing both
ChainOfTableQueryEngineandserialize_tableand it worked for me.Are you sure that you are using a fresh virtual environment? It looks like you’re using conda, please try this:
And with
venvactive:Thanks @jaideep11061982 for raising. Can confirm that I am able to reproduce the bug. Looks like this is caused by the logic for downloading packs not taking into account of multi-level code structure. Specifically, its looking for the
base.pyfile, but for this pack, the “base.py” files are found one level deeper in the source code.Will submit a fix for this shortly.