Skip to content

[Fix] use venv Python for swerl_gen Ray workers instead of hardcoded PYTHONPATH#920

Merged
bxyu-nvidia merged 1 commit intoNVIDIA-NeMo:mainfrom
spacegoing:fix_swerl_ray_py_path
Mar 20, 2026
Merged

[Fix] use venv Python for swerl_gen Ray workers instead of hardcoded PYTHONPATH#920
bxyu-nvidia merged 1 commit intoNVIDIA-NeMo:mainfrom
spacegoing:fix_swerl_ray_py_path

Conversation

@spacegoing
Copy link
Copy Markdown
Contributor

Fix: use venv Python for swerl_gen Ray workers

Replace the hardcoded PYTHONPATH="/opt/nemo-rl/3rdparty/Gym-workspace/Gym" in singularity_utils.py with py_executable: sys.executable.

Problem

The compute_score Ray remote task hardcodes an internal deployment path in its runtime_env. This breaks any setup where Gym is installed at a different location.

Fix

Set py_executable: sys.executable so Ray workers use the same venv Python as the server process. Since nemo_gym is installed as an editable package and resources_servers is included in pyproject.toml's package list, all imports resolve correctly from the venv — no PYTHONPATH override needed.

This is the same pattern applied to compute_code_generation_metrics.py in #908.

…PYTHONPATH

Signed-off-by: spacegoing <spacegoing@gmail.com>
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Mar 20, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@bxyu-nvidia bxyu-nvidia merged commit 34b17b7 into NVIDIA-NeMo:main Mar 20, 2026
5 checks passed
MahanFathi pushed a commit that referenced this pull request Mar 24, 2026
…PYTHONPATH (#920)

## Fix: use venv Python for swerl_gen Ray workers

Replace the hardcoded
`PYTHONPATH="/opt/nemo-rl/3rdparty/Gym-workspace/Gym"` in
`singularity_utils.py` with `py_executable: sys.executable`.

### Problem

The `compute_score` Ray remote task hardcodes an internal deployment
path in its `runtime_env`. This breaks any setup where Gym is installed
at a different location.

### Fix

Set `py_executable: sys.executable` so Ray workers use the same venv
Python as the server process. Since `nemo_gym` is installed as an
editable package and `resources_servers` is included in
`pyproject.toml`'s package list, all imports resolve correctly from the
venv — no `PYTHONPATH` override needed.

This is the same pattern applied to `compute_code_generation_metrics.py`
in #908.

Signed-off-by: spacegoing <spacegoing@gmail.com>
jsw-zorro pushed a commit to niletron/Gym that referenced this pull request Apr 7, 2026
…PYTHONPATH (NVIDIA-NeMo#920)

## Fix: use venv Python for swerl_gen Ray workers

Replace the hardcoded
`PYTHONPATH="/opt/nemo-rl/3rdparty/Gym-workspace/Gym"` in
`singularity_utils.py` with `py_executable: sys.executable`.

### Problem

The `compute_score` Ray remote task hardcodes an internal deployment
path in its `runtime_env`. This breaks any setup where Gym is installed
at a different location.

### Fix

Set `py_executable: sys.executable` so Ray workers use the same venv
Python as the server process. Since `nemo_gym` is installed as an
editable package and `resources_servers` is included in
`pyproject.toml`'s package list, all imports resolve correctly from the
venv — no `PYTHONPATH` override needed.

This is the same pattern applied to `compute_code_generation_metrics.py`
in NVIDIA-NeMo#908.

Signed-off-by: spacegoing <spacegoing@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants