Skip to content

Commit 905259f

Browse files
authored
Fix: use python3 in debugger server.sh (#1590)
### What does this PR do? Type of change: Bug fix `tools/debugger/server.sh` invokes `python -c "..."` inside `check_modelopt_local` (and `pip install -e .[dev]` in the fallback path). Containers that only ship `python3` (no `python` shim) cause the check to fail with `python: command not found`, exit 127. The server interprets this as "modelopt not editable-installed", runs `pip install`, the second check fails the same way, and the server aborts before it ever listens for commands. Switches both the inline import check and the install fallback to `python3` / `python3 -m pip`. ### Usage ```bash bash tools/debugger/server.sh # now starts cleanly on python3-only images ``` ### Testing Verified inside a container where `which python` returns nothing and `python3` is `/usr/bin/python3` (Python 3.12). With the old script, `server.sh` aborted at `check_modelopt_local`. With this fix, the check passes against an existing editable install and the server proceeds to wait for the client handshake. ### Before your PR is "*Ready for review*" - Is this change backward compatible?: ✅ — `python3` is present on every image that previously had `python`. - If you copied code from any other sources or added a new PIP dependency, did you follow guidance in `CONTRIBUTING.md`: N/A - Did you write any new necessary tests?: N/A — internal tooling shell script. - Did you update [Changelog](https://github.com/NVIDIA/Model-Optimizer/blob/main/CHANGELOG.rst)?: N/A — internal debugger tooling, not user-facing. - Did you get Claude approval on this PR?: N/A <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated debugger tooling to ensure consistent use of Python 3 for package validation and installation processes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Chenjie Luo <chenjiel@nvidia.com>
1 parent 38c7843 commit 905259f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tools/debugger/server.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mkdir -p "$CMD_DIR" "$RESULT_DIR"
9999

100100
# Ensure modelopt is editable-installed from WORKDIR
101101
check_modelopt_local() {
102-
python -c "
102+
python3 -c "
103103
import modelopt, os, sys
104104
actual = os.path.realpath(modelopt.__path__[0])
105105
expected = os.path.realpath('$WORKDIR')
@@ -112,11 +112,11 @@ if os.path.commonpath([actual, expected]) != expected:
112112
if check_modelopt_local >/dev/null 2>&1; then
113113
echo "[server] modelopt already editable-installed from $WORKDIR, skipping pip install."
114114
else
115-
echo "[server] Installing modelopt (pip install -e .[dev]) ..."
116-
(cd "$WORKDIR" && pip install -e ".[dev]")
115+
echo "[server] Installing modelopt (python3 -m pip install -e .[dev]) ..."
116+
(cd "$WORKDIR" && python3 -m pip install -e ".[dev]")
117117
if ! check_modelopt_local; then
118118
echo "[server] ERROR: modelopt is not running from the local folder ($WORKDIR)."
119-
echo "[server] Try: pip install -e '.[dev]' inside the container, then restart the server."
119+
echo "[server] Try: python3 -m pip install -e '.[dev]' inside the container, then restart the server."
120120
exit 1
121121
fi
122122
echo "[server] Install done."

0 commit comments

Comments
 (0)