ModelTC / lightllm

LightLLM is a Python-based LLM (Large Language Model) inference and serving framework, notable for its lightweight design, easy scalability, and high-speed performance.
Apache License 2.0
2.53k stars 198 forks source link

[BUG] Unable to install with pip because PyO3 cannot be installed under Python 3.13 #575

Open yookoala opened 1 day ago

yookoala commented 1 day ago

Issue description:

I am unable to install the latest lightllm (1.24.5) with pip in Python 3.13.0 environment because one of the dependencies, PyO3, explicitly prohibit installation in Python version bigger than 3.12.x.

Steps to reproduce:

Please list the steps to reproduce the issue, such as:

  1. Install a Linux environment with Python 3.13 as default (e.g. Fedora 41) with rust / cargo installed.
  2. pip install lightllm
  3. See error

Expected behavior:

Install without a problem

Error logging:

Collecting litellm==1.24.5 (from litellm)
  Using cached litellm-1.24.5-py3-none-any.whl.metadata (13 kB)
...
...
      error: failed to run custom build command for `pyo3-ffi v0.21.2`

      Caused by:
        process didn't exit successfully: `/tmp/pip-install-oyd1_m1x/tokenizers_62ef928fe8ec474bbbfce1945c44b007/bindings/python/target/release/build/pyo3-ffi-c3165566ac7be924/build-script-build` (exit status: 1)
        --- stdout
        cargo:rerun-if-env-changed=PYO3_CROSS
        cargo:rerun-if-env-changed=PYO3_CROSS_LIB_DIR
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_VERSION
        cargo:rerun-if-env-changed=PYO3_CROSS_PYTHON_IMPLEMENTATION
        cargo:rerun-if-env-changed=PYO3_PRINT_CONFIG
        cargo:rerun-if-env-changed=PYO3_USE_ABI3_FORWARD_COMPATIBILITY

        --- stderr
        error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
        = help: please check if an updated version of PyO3 is available. Current version: 0.21.2
        = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
      warning: build failed, waiting for other jobs to finish...
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.13-64bit" PYO3_PYTHON="/usr/bin/python3" PYTHON_SYS_EXECUTABLE="/usr/bin/python3" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-oyd1_m1x/tokenizers_62ef928fe8ec474bbbfce1945c44b007/bindings/python/Cargo.toml" "--release" "--lib"`
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/usr/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (tokenizers)

If applicable, please copy and paste the error message or stack trace here. Use code blocks for better readability.

Environment:

Please provide information about your environment, such as:

Additional context:

hiworldwzj commented 1 day ago

@yookoala lightllm has not been tested in python 3.13 (too latest). so there may be some env issues. we will support python 3.13 in future. Now we suggest to use python 3.9 to install lightllm.

yookoala commented 1 day ago

I believe lightllm itself is not a problem here. Rather tokenizers (https://github.com/huggingface/tokenizers/issues/1657) is depending on older pyo3, which requires Python 3.12 or below. Works like https://github.com/huggingface/tokenizers/pull/1646 could probably fix the issue.

yookoala commented 1 day ago

I suggest to keep this bug alive to keep track the issue for user(s) who faces the problem.