Skip to content

Commit 24238a7

Browse files
authored
Merge pull request #852 from Gujiassh/docs/kotlin-code-interpreter-pip-648
docs(kotlin): clarify code-interpreter image for pip usage
2 parents 742fae9 + e928000 commit 24238a7

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

sdks/code-interpreter/kotlin/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,28 @@ The Code Interpreter SDK relies on a specialized environment. Ensure your sandbo
102102

103103
For detailed information about supported languages and versions, please refer to the [Environment Documentation](../../../sandboxes/code-interpreter/README.md).
104104

105+
### Troubleshooting: `pip: command not found`
106+
107+
If you are using the Kotlin/Java client and run shell commands such as
108+
`pip install pandas`, make sure the sandbox is created from the
109+
`opensandbox/code-interpreter` image (or a derivative) and uses the
110+
Code Interpreter entrypoint:
111+
112+
```java
113+
Sandbox sandbox = Sandbox.builder()
114+
.image("opensandbox/code-interpreter:v1.0.2")
115+
.entrypoint("/opt/opensandbox/code-interpreter.sh")
116+
.env("PYTHON_VERSION", "3.11")
117+
.build();
118+
```
119+
120+
The plain Sandbox SDK can also talk to generic sandbox images, but those
121+
images are not guaranteed to include Python or `pip`. In that case,
122+
commands such as `pip install ...` will fail with `pip: command not found`.
123+
Use the package manager that matches the image you launched, or switch to the
124+
Code Interpreter image when you need Python package installation/runtime
125+
behavior.
126+
105127
### Language Version Selection
106128

107129
You can specify the desired version of a programming language by setting the corresponding environment variable when building the `Sandbox`.

sdks/code-interpreter/kotlin/README_zh.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ Code Interpreter SDK 依赖于特定的运行环境。请确保你的沙箱服
102102

103103
关于支持的语言和具体版本的详细信息,请参考 [环境文档](../../../sandboxes/code-interpreter/README_zh.md)
104104

105+
### 排错:`pip: command not found`
106+
107+
如果你在 Kotlin / Java 客户端里执行了 `pip install pandas` 这类命令,请先确认
108+
当前沙箱使用的是 `opensandbox/code-interpreter` 镜像(或其衍生镜像),并且入口点
109+
是 Code Interpreter 的启动脚本:
110+
111+
```java
112+
Sandbox sandbox = Sandbox.builder()
113+
.image("opensandbox/code-interpreter:v1.0.2")
114+
.entrypoint("/opt/opensandbox/code-interpreter.sh")
115+
.env("PYTHON_VERSION", "3.11")
116+
.build();
117+
```
118+
119+
普通 Sandbox SDK 也可以连接任意通用沙箱镜像,但这些镜像并不保证预装 Python 或
120+
`pip`。在这种情况下,执行 `pip install ...` 会报 `pip: command not found`
121+
如果需要 Python 运行时和包管理能力,请切换到 Code Interpreter 镜像;否则请使用
122+
与你当前镜像匹配的包管理方式。
123+
105124
### 语言版本选择
106125

107126
你可以在创建 `Sandbox` 时通过环境变量指定所需的编程语言版本。

0 commit comments

Comments
 (0)