From 0ea292290e35725ffa7e2b61347a85d3c7ccac92 Mon Sep 17 00:00:00 2001 From: linzhenqi Date: Sun, 15 Feb 2026 11:11:38 +0800 Subject: [PATCH] [Enhancement](pyudf) add helper command to show more py info --- .../udf/python-user-defined-function.md | 72 +++++++++++++++++++ .../udf/python-user-defined-function.md | 71 +++++++++++++++++- 2 files changed, 142 insertions(+), 1 deletion(-) diff --git a/docs/query-data/udf/python-user-defined-function.md b/docs/query-data/udf/python-user-defined-function.md index 0de878382e282..4f4923c62bb72 100644 --- a/docs/query-data/udf/python-user-defined-function.md +++ b/docs/query-data/udf/python-user-defined-function.md @@ -3148,6 +3148,8 @@ max_python_process_num = 32 Verify on each BE node whether the environment is correct: +#### Verify the environment on each BE node: + ```bash # Conda mode /opt/miniconda3/envs/py39/bin/python --version @@ -3158,6 +3160,76 @@ Verify on each BE node whether the environment is correct: /doris/python_envs/python3.9.18/bin/python -c "import pandas; print(pandas.__version__)" ``` + +#### Display all Python versions shared by BE. +```sql +SHOW PYTHON VERSIONS; +``` +```text ++---------+---------+---------+-------------------+----------------------------------------+ +| Version | EnvName | EnvType | BasePath | ExecutablePath | ++---------+---------+---------+-------------------+----------------------------------------+ +| 3.9.18 | py39 | conda | path/to/miniconda | path/to/miniconda/envs/py39/bin/python | ++---------+---------+---------+-------------------+----------------------------------------+ +``` + +#### Display installed dependencies in the specified version +Use `SHOW PYTHON PACKAGES IN ''` to display the installed dependencies in the specified version. If there are dependencies that differ among the BEs, they will be listed separately. +```sql +SHOW PYTHON PACKAGES IN '3.9.18' +``` +Each BE has the same installation status: +```text ++-----------------+-------------+ +| Package | Version | ++-----------------+-------------+ +| pyarrow | 21.0.0 | +| Bottleneck | 1.4.2 | +| jieba | 0.42.1 | +| six | 1.17.0 | +| wheel | 0.45.1 | +| python-dateutil | 2.9.0.post0 | +| tzdata | 2025.3 | +| setuptools | 80.9.0 | +| numpy | 2.0.1 | +| psutil | 7.0.0 | +| pandas | 2.3.3 | +| mkl_random | 1.2.8 | +| pip | 25.3 | +| snownlp | 0.12.3 | +| pytz | 2025.2 | +| mkl_fft | 1.3.11 | +| mkl-service | 2.4.0 | +| numexpr | 2.10.1 | ++-----------------+-------------+ +``` +Each BE has different installation status: +```text ++-----------------+-------------+------------+----------------+ +| Package | Version | Consistent | Backends | ++-----------------+-------------+------------+----------------+ +| pyarrow | 21.0.0 | Yes | | +| Bottleneck | 1.4.2 | Yes | | +| six | 1.17.0 | Yes | | +| jieba | 0.42.1 | No | 127.0.0.1:9660 | +| wheel | 0.45.1 | Yes | | +| python-dateutil | 2.9.0.post0 | Yes | | +| tzdata | 2025.3 | Yes | | +| setuptools | 80.9.0 | Yes | | +| numpy | 2.0.1 | Yes | | +| psutil | 7.0.0 | No | 127.0.0.1:9660 | +| pandas | 2.3.3 | Yes | | +| mkl_random | 1.2.8 | Yes | | +| pip | 26.0.1 | No | 127.0.0.1:9077 | +| pip | 25.3 | No | 127.0.0.1:9660 | +| snownlp | 0.12.3 | No | 127.0.0.1:9660 | +| pytz | 2025.2 | Yes | | +| numexpr | 2.10.1 | Yes | | +| mkl-service | 2.4.0 | Yes | | +| mkl_fft | 1.3.11 | Yes | | ++-----------------+-------------+------------+----------------+ +``` + ### Common Problem Troubleshooting #### Q1: UDF call prompts "Python environment not found" diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md index 8bf7c3f81704e..58d2a6236300e 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/query-data/udf/python-user-defined-function.md @@ -3146,7 +3146,7 @@ max_python_process_num = 32 ### 环境验证 -在每个 BE 节点上验证环境是否正确: +#### 在每个 BE 节点上验证环境是否正确: ```bash # Conda 模式 @@ -3158,6 +3158,75 @@ max_python_process_num = 32 /doris/python_envs/python3.9.18/bin/python -c "import pandas; print(pandas.__version__)" ``` +#### 展示所有 BE 共有的 python 版本 +```sql +SHOW PYTHON VERSIONS; +``` +```text ++---------+---------+---------+-------------------+----------------------------------------+ +| Version | EnvName | EnvType | BasePath | ExecutablePath | ++---------+---------+---------+-------------------+----------------------------------------+ +| 3.9.18 | py39 | conda | path/to/miniconda | path/to/miniconda/envs/py39/bin/python | ++---------+---------+---------+-------------------+----------------------------------------+ +``` + +#### 展示指定版本中已安装的依赖 +使用`SHOW PYTHON PACKAGES IN ''` 来展示指定版本中已安装的依赖,如果各 BE 存在依赖不相同的情况,会列出不相 +```sql +SHOW PYTHON PACKAGES IN '3.9.18' +``` +各 BE 依赖安装情况完全相同: +```text ++-----------------+-------------+ +| Package | Version | ++-----------------+-------------+ +| pyarrow | 21.0.0 | +| Bottleneck | 1.4.2 | +| jieba | 0.42.1 | +| six | 1.17.0 | +| wheel | 0.45.1 | +| python-dateutil | 2.9.0.post0 | +| tzdata | 2025.3 | +| setuptools | 80.9.0 | +| numpy | 2.0.1 | +| psutil | 7.0.0 | +| pandas | 2.3.3 | +| mkl_random | 1.2.8 | +| pip | 25.3 | +| snownlp | 0.12.3 | +| pytz | 2025.2 | +| mkl_fft | 1.3.11 | +| mkl-service | 2.4.0 | +| numexpr | 2.10.1 | ++-----------------+-------------+ +``` +各 BE 安装依赖情况不同: +```text ++-----------------+-------------+------------+----------------+ +| Package | Version | Consistent | Backends | ++-----------------+-------------+------------+----------------+ +| pyarrow | 21.0.0 | Yes | | +| Bottleneck | 1.4.2 | Yes | | +| six | 1.17.0 | Yes | | +| jieba | 0.42.1 | No | 127.0.0.1:9660 | +| wheel | 0.45.1 | Yes | | +| python-dateutil | 2.9.0.post0 | Yes | | +| tzdata | 2025.3 | Yes | | +| setuptools | 80.9.0 | Yes | | +| numpy | 2.0.1 | Yes | | +| psutil | 7.0.0 | No | 127.0.0.1:9660 | +| pandas | 2.3.3 | Yes | | +| mkl_random | 1.2.8 | Yes | | +| pip | 26.0.1 | No | 127.0.0.1:9077 | +| pip | 25.3 | No | 127.0.0.1:9660 | +| snownlp | 0.12.3 | No | 127.0.0.1:9660 | +| pytz | 2025.2 | Yes | | +| numexpr | 2.10.1 | Yes | | +| mkl-service | 2.4.0 | Yes | | +| mkl_fft | 1.3.11 | Yes | | ++-----------------+-------------+------------+----------------+ +``` + ### 常见问题排查 #### Q1: UDF 调用时提示 "Python environment not found"