Skip to content

[Bug] install sglang by pip install sglang[all]>=0.4.9, work well when run llama3 model, but raise "most likely due to a circular import" error when check ColumnParallelLinear op.. #7919

@knote2019

Description

@knote2019

Checklist

  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
  • 4. If the issue you raised is not a bug but a question, please raise a discussion at https://github.com/sgl-project/sglang/discussions/new/choose Otherwise, it will be closed.
  • 5. Please use English, otherwise it will be closed.

Describe the bug

from sglang.srt.layers.linear import ColumnParallelLinear
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py", line 30, in
from sglang.srt.layers.quantization.base_config import (
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/quantization/init.py", line 52, in
from sglang.srt.layers.linear import LinearBase, UnquantizedLinearMethod
ImportError: cannot import name 'LinearBase' from partially initialized module 'sglang.srt.layers.linear' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py)

Reproduction

dockerfile:

install torch.

ENV TORCH_CUDA_ARCH_LIST="8.0"
RUN set -x
&& pip install torch
&& echo "end"

install flashinfer.

RUN set -x
&& git clone -b v0.2.7.post1 --recursive --depth=1 https://github.com/flashinfer-ai/flashinfer.git /usr/local/flashinfer
&& pip install /usr/local/flashinfer --no-build-isolation --verbose
&& echo "end"

install sglang.

RUN set -x
&& pip install sglang[all]>=0.4.9
&& echo "end"

then run docker.

then test with:
[root@e13066a1a980 ~]$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from sglang.srt.layers.linear import ColumnParallelLinear
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py", line 30, in
from sglang.srt.layers.quantization.base_config import (
File "/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/quantization/init.py", line 52, in
from sglang.srt.layers.linear import LinearBase, UnquantizedLinearMethod
ImportError: cannot import name 'LinearBase' from partially initialized module 'sglang.srt.layers.linear' (most likely due to a circular import) (/usr/local/lib/python3.10/dist-packages/sglang/srt/layers/linear.py)

Environment

can reproduced in this docker image: lmsysorg/sglang:v0.4.8.post1-cu126

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions