If you're ready to get started, here's a simple setup guide to help you along the way:

  1. Install poetry:

    curl -sSL https://install.python-poetry.org | python3 -

  2. Clone the repo:

    git clone https://github.com/run-llama/llama_index.git

  3. Go to project folder:

    cd llama_index

  4. Set up a new virtual environment:

    poetry shell

  5. Install development dependencies:

    poetry install --only dev,docs

  6. Install the package(s) you want to work on:

    pip install -e llama-index-core

Running the last command may produce the following warning:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
llama-index 0.11.22 requires llama-index-agent-openai<0.4.0,>=0.3.4, which is not installed.
llama-index 0.11.22 requires llama-index-cli<0.4.0,>=0.3.1, which is not installed.
llama-index 0.11.22 requires llama-index-embeddings-openai<0.3.0,>=0.2.4, which is not installed.
llama-index 0.11.22 requires llama-index-indices-managed-llama-cloud>=0.3.0, which is not installed.
llama-index 0.11.22 requires llama-index-legacy<0.10.0,>=0.9.48, which is not installed.
llama-index 0.11.22 requires llama-index-llms-openai<0.3.0,>=0.2.10, which is not installed.
llama-index 0.11.22 requires llama-index-multi-modal-llms-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-program-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-question-gen-openai<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-readers-file<0.3.0,>=0.2.0, which is not installed.
llama-index 0.11.22 requires llama-index-readers-llama-parse>=0.3.0, which is not installed.

To avoid this issue, you can run poetry install instead of poetry install --only dev,docs, or alternatively, you can install the dependencies manually using pip:

pip install llama-index-agent-openai llama-index-cli llama-index-embeddings-openai llama-index-indices-managed-llama-cloud llama-index-legacy llama-index-llms-openai llama-index-multi-modal-llms-openai llama-index-program-openai llama-index-question-gen-openai llama-index-readers-file llama-index-readers-llama-parse


Testing:

To verify your installation, run the following command:

from llama_index.core import SimpleDirectoryReader

You can also run pytest from each package individually. However, make sure to install tree-sitter and tree-sitter-languages first.


Troubleshooting:

If your system is using an older version of Poetry, you may encounter compatibility issues. To resolve this, check your current Poetry version and update to the latest release.

For example, if you run apt install python3-poetry on Ubuntu 22.04, it will install Poetry version 1.1.12, which is not compatible with LlamaIndex. To ensure compatibility, you'll need to install a more recent version of Poetry.

$ poetry shell

  RuntimeError

  The Poetry configuration is invalid:
    - Additional properties are not allowed ('group' was unexpected)
    - [source.0] Additional properties are not allowed ('priority' was unexpected)

  at /usr/lib/python3/dist-packages/poetry/core/factory.py:43 in create_poetry
       39│             message = ""
       40│             for error in check_result["errors"]:
       41│                 message += "  - {}\n".format(error)
       42│ 
    →  43│             raise RuntimeError("The Poetry configuration is invalid:\n" + message)
       44│ 
       45│         # Load package
       46│         name = local_config["name"]
       47│         version = local_config["version"]

Reference:

  1. https://docs.llamaindex.ai/en/stable/CONTRIBUTING/

Previous Post Next Post