sgl-project/sglang · info · UserWarning
'python -m sglang.launch_server' is still supported, but 'sg
Error message
'python -m sglang.launch_server' is still supported, but 'sglang serve' is the recommended entrypoint. Example: sglang serve --model-path <model> [options]
What it means
Running 'python -m sglang.launch_server' still works but is no longer the recommended CLI. The modern entrypoint is the 'sglang serve' subcommand; the old module path emits this UserWarning at startup.
Source
Thrown at python/sglang/launch_server.py:63
# Ray mode: HTTP mode with Ray backend.
try:
from sglang.srt.ray.http_server import launch_server
except ImportError:
raise ImportError(
"Ray is required for --use-ray mode. "
"Install it with: pip install 'sglang[ray]'"
)
launch_server(server_args)
else:
# Default mode: HTTP mode.
from sglang.srt.entrypoints.http_server import launch_server
launch_server(server_args)
if __name__ == "__main__":
warnings.warn(
"'python -m sglang.launch_server' is still supported, but "
"'sglang serve' is the recommended entrypoint.\n"
" Example: sglang serve --model-path <model> [options]",
UserWarning,
stacklevel=1,
)
load_plugins()
server_args = prepare_server_args(sys.argv[1:])
try:
run_server(server_args)
finally:
kill_process_tree(os.getpid(), include_parent=False)
View on GitHub (pinned to 0132848349)
Solutions
- Replace with: sglang serve --model-path <model> [options]
- Update Docker CMD/ENTRYPOINT and any orchestration templates accordingly
- If you must keep the old form temporarily, silence with PYTHONWARNINGS or warnings filter, but plan migration
Example fix
# before python -m sglang.launch_server --model-path meta-llama/Llama-3-8B-Instruct # after sglang serve --model-path meta-llama/Llama-3-8B-Instruct
Defensive patterns
Strategy: validation
Validate before calling
import subprocess, sys subprocess.run(["sglang", "serve", "--model-path", model, *extra_args])
Prevention
- Pin launch commands in a single script constant
- Grep deploy scripts for 'python -m sglang.launch_server' each upgrade
When it happens
Trigger: Executing python -m sglang.launch_server --model-path ... directly, or a legacy systemd/Docker launch script/deployment YAML that still invokes the module form.
Common situations: Upgrading sglang and old deployment manifests keep the module invocation; copy-pasted launch commands from older blog posts or READMEs.
Related errors
- 'data_parallel_rank' is deprecated, use 'routed_dp_rank' ins
- 'data_parallel_rank' is deprecated, use 'routed_dp_rank' ins
- Environment variable '{self.deprecated_name}' is deprecated;
- Environment variable {old_name} is deprecated. Please use {s
- Environment variable {key} is deprecated, please use {new_ke
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/83e33f2f4d076087.
Report an issue: GitHub.