π OpenHands: AI-Driven Development
Jupyter: remove poetry dependency (#9561)
Boxuan Li29fdc701a3b0
diff --git a/openhands/runtime/impl/local/local_runtime.py b/openhands/runtime/impl/local/local_runtime.pyindex 0b07d6c713..d8076d78b0 100644--- a/openhands/runtime/impl/local/local_runtime.py+++ b/openhands/runtime/impl/local/local_runtime.py@@ -73,20 +73,16 @@ def get_user_info() -> tuple[int, str | None]:return os.getuid(), username-def check_dependencies(code_repo_path: str, poetry_venvs_path: str) -> None:+def check_dependencies(code_repo_path: str, env_root_path: str) -> None:ERROR_MESSAGE = 'Please follow the instructions in https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md to install OpenHands.'if not os.path.exists(code_repo_path):raise ValueError(f'Code repo path {code_repo_path} does not exist. ' + ERROR_MESSAGE)- if not os.path.exists(poetry_venvs_path):- raise ValueError(- f'Poetry venvs path {poetry_venvs_path} does not exist. ' + ERROR_MESSAGE- )# Check jupyter is installedlogger.debug('Checking dependencies: Jupyter')output = subprocess.check_output(- ['poetry', 'run', 'jupyter', '--version'],+ [sys.executable, '-m', 'jupyter', '--version'],text=True,cwd=code_repo_path,)@@ -287,7 +283,8 @@ class LocalRuntime(ActionExecutionClient):server_port=self._execution_server_port,plugins=self.plugins,app_config=self.config,- python_prefix=['poetry', 'run'],+ python_prefix=[],+ python_executable=sys.executable,override_user_id=self._user_id,override_username=self._username,)diff --git a/openhands/runtime/plugins/jupyter/__init__.py b/openhands/runtime/plugins/jupyter/__init__.pyindex 4268d10ba0..a5dd28eb87 100644--- a/openhands/runtime/plugins/jupyter/__init__.py+++ b/openhands/runtime/plugins/jupyter/__init__.py@@ -61,7 +61,7 @@ class JupyterPlugin(Plugin):# Windows-specific command formatjupyter_launch_command = (f'cd /d "{code_repo_path}" && '- 'poetry run jupyter kernelgateway '+ f'"{sys.executable}" -m jupyter kernelgateway ''--KernelGatewayApp.ip=0.0.0.0 'f'--KernelGatewayApp.port={self.kernel_gateway_port}')@@ -105,7 +105,7 @@ class JupyterPlugin(Plugin):jupyter_launch_command = (f"{prefix}/bin/bash << 'EOF'\n"f'{poetry_prefix}'- 'poetry run jupyter kernelgateway '+ f'"{sys.executable}" -m jupyter kernelgateway ''--KernelGatewayApp.ip=0.0.0.0 'f'--KernelGatewayApp.port={self.kernel_gateway_port}\n''EOF'diff --git a/openhands/runtime/utils/command.py b/openhands/runtime/utils/command.pyindex 150ace2248..2d0424b47b 100644--- a/openhands/runtime/utils/command.py+++ b/openhands/runtime/utils/command.py@@ -20,6 +20,7 @@ def get_action_execution_server_startup_command(override_user_id: int | None = None,override_username: str | None = None,main_module: str = DEFAULT_MAIN_MODULE,+ python_executable: str = 'python',) -> list[str]:sandbox_config = app_config.sandbox@@ -44,7 +45,7 @@ def get_action_execution_server_startup_command(base_cmd = [*python_prefix,- 'python',+ python_executable,'-u','-m',main_module,