Skip to content

ImportError: cannot import name 'build_regex_from_object' from 'outlines.fsm.json_schema' #203

@nopepper

Description

@nopepper

Description

Running python -m sglang.launch_server yields this error. I was running it in a container, which I'll describe below.

outlines-server-1  | Traceback (most recent call last):
outlines-server-1  |   File "<frozen runpy>", line 198, in _run_module_as_main
outlines-server-1  |   File "<frozen runpy>", line 88, in _run_code
outlines-server-1  |   File "/usr/local/lib/python3.11/site-packages/sglang/launch_server.py", line 3, in <module>
outlines-server-1  |     from sglang.srt.server import ServerArgs, launch_server
outlines-server-1  |   File "/usr/local/lib/python3.11/site-packages/sglang/srt/server.py", line 25, in <module>
outlines-server-1  |     from sglang.srt.constrained import disable_cache
outlines-server-1  |   File "/usr/local/lib/python3.11/site-packages/sglang/srt/constrained/__init__.py", line 4, in <module>
outlines-server-1  |     from outlines.fsm.json_schema import build_regex_from_object
outlines-server-1  | ImportError: cannot import name 'build_regex_from_object' from 'outlines.fsm.json_schema' (/usr/local/lib/python3.11/site-packages/outlines/fsm/json_schema.py)
outlines-server-1 exited with code 1

Reproducing

Here's the dockerfile, super simple:

FROM python:3.11
RUN pip install sglang[all]
ENTRYPOINT [ "python", "-m", "sglang.launch_server" ]

Running:

docker build  --rm -t sglang-server .
docker run sglang-server --model-path mistralai/Mistral-7B-Instruct-v0.2

Notes

I also tried this with the python 3.10 image, same issue. It also didn't work outside of docker.

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