Skip to content

API Server Not Starting - Investigate pkg_resources.DistributionNotFound: async-timeout #1017

@anusonawane

Description

@anusonawane

Do you need to file an issue?

  • I have searched the existing issues and this bug is not already filed.
  • I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

I am encountering significant issues installing the LightRAG API Server from source, following the instructions in the README.md. I consistently receive a pkg_resources.DistributionNotFound: The 'async-timeout<6.0,>=4.0; python_version < "3.11"' distribution was not found and is required by aiohttp error, preventing the server from starting.

Problem Description:

I am attempting to install LightRAG API server from source using the command provided in the README:

pip install -e ".[api]"

Initially, the installation failed with a "Multiple top-level packages discovered in a flat-layout" error. This seemed to be related to the project structure not being properly recognized as a package. I noted that the cloned repository in the lightrag directory did not contain a pyproject.toml file initially.

After creating a pyproject.toml file (with [tool.setuptools.packages.find] section to explicitly define the lightrag package location, as suggested in online resources for similar issues), the "flat-layout" error was resolved, and pip install -e ".[api]" appeared to proceed further without immediate errors during the initial installation phase.

However, when attempting to start the server using lightrag-server, I consistently encounter the following traceback:

Traceback (most recent call last): File "/home/anushkas/.local/bin/lightrag-server", line 6, in <module> from pkg_resources import load_entry_point File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3253, in <module> @_call_aside ^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside f(*args, **kwargs) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set working_set = WorkingSet._build_master() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master ws.require(__requires__) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require needed = self.resolve(parse_requirements(requirements)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'async-timeout<6.0,>=4.0; python_version < "3.11"' distribution was not found and is required by aiohttp

This error persists despite numerous troubleshooting steps.

Attempted Solutions (Unsuccessful):

I have tried the following steps in a dedicated Python virtual environment (venv) to resolve this issue, but none have been successful in starting the lightrag-server:

  • Created multiple fresh virtual environments: Including creating a new virtual environment with python -m venv new_venv and activating it.

  • Ensured init.py exists in the lightrag directory.

  • Created pyproject.toml in the repository root with a [tool.setuptools.packages.find] section to guide package discovery.

  • Upgraded pip to the latest version within the virtual environment: pip install --upgrade pip.

  • Reinstalled aiohttp (multiple times) with --no-cache-dir --force-reinstall: pip install --no-cache-dir --force-reinstall aiohttp.

  • Reinstalled async-timeout (multiple times) with --no-cache-dir --force-reinstall:
    pip install --no-cache-dir --force-reinstall async-timeout
    pip install --no-cache-dir --force-reinstall "async-timeout<6.0,>=4.0; python_version < '3.11'"
    pip install --no-cache-dir --force-reinstall async-timeout==5.0.0 (downgrading to a specific version).

  • Reinstalled setuptools and wheel with --no-cache-dir --force-reinstall: pip install --no-cache-dir --force-reinstall setuptools wheel.

  • Created a virtual environment with --system-site-packages: python -m venv new_venv --system-site-packages.

  • Attempted to reinstall pkg-resources directly: pip install --no-cache-dir --force-reinstall pkg-resources, which failed with "ERROR: Could not find a version that satisfies the requirement pkg-resources (from versions: none) ERROR: No matching distribution found for pkg-resources".

  • Tried installing LightRAG from PyPI (non-editable): pip install lightrag-hku[api].

Despite all these attempts, the pkg_resources.DistributionNotFound: async-timeout error persists when running lightrag-server.

Steps to reproduce

No response

Expected Behavior

No response

LightRAG Config Used

Paste your config here

Logs and screenshots

No response

Additional Information

  • LightRAG Version:
  • Operating System:
  • Python Version:
  • Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions