Skip to content

skip_environment_setup still uses /sandbox/.sandbox-venv/bin/python #127

Description

@CoreJa

Describe the bug
Adding flag skip_environment_setup under k8s(haven't tried other backend yet), container will use /sandbox/.sandbox-venv/bin/python as its default python interpreter, which obviously does not exists.

To Reproduce
Steps to reproduce the behavior:
Run the following:

# Define custom pod manifest
pod_manifest = {
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "name": "any_pod",
    },
    "spec": {
        "containers": [
            {
                "name": "sandbox-container",
                "image": "ghcr.io/vndee/sandbox-python-311-bullseye",
                "tty": True,
                "resources": {
                    "limits": {
                        "memory": "512Mi",
                        "cpu": "500m"
                    },
                    "requests": {
                        "memory": "256Mi",
                        "cpu": "250m"
                    }
                }
            }
        ],
    },
}

session = SandboxSession(
    client=k8s_client,
    backend=SandboxBackend.KUBERNETES,
    lang=SupportedLanguage.PYTHON,
    pod_manifest=pod_manifest,
    skip_environment_setup=True,
    verbose=True,
)

session.open()

session.run("print('Hello from LLM Sandbox!')")

Expected behavior
It should come with a stdout with the following string.

Screenshots

Outcome:

2025-11-30 15:03:18 - llm_sandbox.core.session_base - INFO - Copying /var/folders/c4/9xg90tkd4sd6xdp3cpwfl68w0000gp/T/tmpj2j4571_.py to /sandbox/79ab6a7de6c34c2399b27a57bf656534.py
2025-11-30 15:03:22 - llm_sandbox.core.session_base - INFO - Executing command: id -u
2025-11-30 15:03:23 - llm_sandbox.core.session_base - INFO - STDOUT: 0

2025-11-30 15:03:23 - llm_sandbox.core.session_base - INFO - Executing command: /sandbox/.sandbox-venv/bin/python /sandbox/79ab6a7de6c34c2399b27a57bf656534.py
2025-11-30 15:03:24 - llm_sandbox.core.session_base - ERROR - STDERR: /bin/sh: 1: /sandbox/.sandbox-venv/bin/python: not found

Additional context

As for session.run_command, it is well executed:

session.execute_command("python --version")
2025-11-30 15:07:03 - llm_sandbox.core.session_base - INFO - Executing command: python --version
2025-11-30 15:07:04 - llm_sandbox.core.session_base - INFO - STDOUT: Python 3.11.13

Is there a parameter or anything like it that I can pass to specify the python it should be using? Any help is much appreciated!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions