Jupyter: remove poetry dependency (#9561)

This commit is contained in:
Boxuan Li 2025-07-05 15:03:26 -07:00 committed by GitHub
parent 8bc9207c24
commit 29fdc701a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 10 deletions

View File

@ -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 installed
logger.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,
)

View File

@ -61,7 +61,7 @@ class JupyterPlugin(Plugin):
# Windows-specific command format
jupyter_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'

View File

@ -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,