Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] runner.js is not bundled into the tarball on PyPI as of 2.6.6 #7853

Closed
tevino opened this issue Feb 26, 2025 · 0 comments
Closed

[Bug] runner.js is not bundled into the tarball on PyPI as of 2.6.6 #7853

tevino opened this issue Feb 26, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@tevino
Copy link

tevino commented Feb 26, 2025

What happened?

The "agents" example from the official website failed due to a failure of evaluate_math.

def evaluate_math(expression: str):
    return dspy.PythonInterpreter({}).execute(expression)
Failed to execute: No output from Deno subprocess. Stderr: error: Module not found "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/runner.js".

Observation

Related implementation from dspy:

class PythonInterpreter:
    r"""
    PythonInterpreter that runs code in a sandboxed environment using Deno and Pyodide.

    Prerequisites:
    - Deno (https://docs.deno.com/runtime/getting_started/installation/).

    Example Usage:
    ```python
    code_string = "print('Hello'); 1 + 2"
    interp = PythonInterpreter()
    output = interp(code_string)
    print(output)  # If final statement is non-None, prints the numeric result, else prints captured output
    interp.shutdown()
    ```
    """

    def __init__(
        self,
        deno_command: Optional[List[str]] = None
    ) -> None:
        if isinstance(deno_command, dict):
            deno_command = None  # no-op, just a guard in case someone passes a dict
        self.deno_command = deno_command or [
            "deno", "run", "--allow-read", self._get_runner_path()
        ]
        self.deno_process = None

    def _get_runner_path(self) -> str:
        current_dir = os.path.dirname(os.path.abspath(__file__))
        return os.path.join(current_dir, "runner.js")  # <--- looking for runner.js

This file should be bundled into the release of dspy, but it's not: /dspy/primitives/runner.js.

As of 2.6.6 the release from PyPI is still broken, there's no primitives/runner.js in the tarball.

SHA256 8fb08bb8009c51d3f972856c19620cab2cc5e2b5a4c379005441bd81267ce905

The same issue was reported and fixed here: #7490

Steps to reproduce

import dspy

dspy.PythonInterpreter({}).execute("1+1")

Output:

Traceback (most recent call last):
  File "/dspy/main.py", line 3, in <module>
    dspy.PythonInterpreter({}).execute("1+1")
  File "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/python_interpreter.py", line 111, in execute
    raise InterpreterError(f"No output from Deno subprocess. Stderr: {err_output}")
dspy.primitives.python_interpreter.InterpreterError: No output from Deno subprocess. Stderr: error: Module not found "/dspy/.venv/lib/python3.12/site-packages/dspy/primitives/runner.js".

DSPy version

2.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants