Ubuntu下用Poetry安装ArcGIS API时gssapi-1.8.2.tar.gz安装失败求助
解决Ubuntu 20.04下Poetry安装ArcGIS API时gssapi依赖失败的问题
问题描述
在Ubuntu 20.04系统中使用Poetry 1.2.1创建虚拟环境,执行poetry add arcgis命令安装ArcGIS API时,出现gssapi(1.8.2)安装失败的错误,核心报错信息为krb5-config: not found,导致无法完成wheel构建。无法使用Conda处理该项目,以下是完整错误日志及pyproject.toml配置:
完整错误日志
• Installing gssapi (1.8.2): Failed CalledProcessError Command '['/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8', '--no-deps', '/home/max/.cache/pypoetry/artifacts/64/da/a9/a06afe5c1d5ef8f2f266a3d030f065759a2632a554b16410139032456d/gssapi-1.8.2.tar.gz']' returned non-zero exit status 1. at /usr/lib/python3.8/subprocess.py:516 in run 512│ # We don't call process.wait() as .__exit__ does that for us. 513│ raise 514│ retcode = process.poll() 515│ if check and retcode: → 516│ raise CalledProcessError(retcode, process.args, 517│ output=stdout, stderr=stderr) 518│ return CompletedProcess(process.args, retcode, stdout, stderr) 519│ 520│ The following error occurred when trying to handle this error: EnvCommandError Command ['/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8', '--no-deps', '/home/max/.cache/pypoetry/artifacts/64/da/a9/a06afe5c1d5ef8f2f266a3d030f065759a2632a554b16410139032456d/gssapi-1.8.2.tar.gz'] errored with the following return code 1, and output: Processing /home/max/.cache/pypoetry/artifacts/64/da/a9/a06afe5c1d5ef8f2f266a3d030f065759a2632a554b16410139032456d/gssapi-1.8.2.tar.gz Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [21 lines of output] /bin/sh: 1: krb5-config: not found Traceback (most recent call last): File "/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module> main() File "/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/max/.cache/pypoetry/virtualenvs/arcgis-api-UPBhVADH-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-gh_kkuy0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-gh_kkuy0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-gh_kkuy0/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup exec(code, locals()) File "<string>", line 109, in <module> File "<string>", line 22, in get_output File "/usr/lib/python3.8/subprocess.py", line 415, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command 'krb5-config --libs gssapi' returned non-zero exit status 127. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:1476 in _run 1472│ output = subprocess.check_output( 1473│ command, stderr=subprocess.STDOUT, env=env, **kwargs 1474│ ) 1475│ except CalledProcessError as e: → 1476│ raise EnvCommandError(e, input=input_) 1477│ 1478│ return decode(output) 1479│ 1480│ def execute(self, bin: str, *args: str, **kwargs: Any) -> int: The following error occurred when trying to handle this error: PoetryException Failed to install /home/max/.cache/pypoetry/artifacts/64/da/a9/a06afe5c1d5ef8f2f266a3d030f065759a2632a554b16410139032456d/gssapi-1.8.2.tar.gz at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/pip.py:51 in pip_install 47│ 48│ try: 49│ return environment.run_pip(*args) 50│ except EnvCommandError as e: → 51│ raise PoetryException(f"Failed to install {path.as_posix()}") from e 52│
pyproject.toml配置
[tool.poetry] name = "arcgis-api" version = "0.1.0" description = "" authors = [] readme = "README.md" packages = [{include = "arcgis_api"}] [tool.poetry.dependencies] python = ">=3.8,<3.10" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"
解决方案
1. 安装缺失的系统依赖
报错中的krb5-config是Kerberos开发工具集的一部分,Ubuntu系统中需要安装对应的包来获取该工具:
sudo apt update sudo apt install libkrb5-dev
这个包会提供gssapi编译时必需的krb5-config工具,解决依赖缺失问题。
2. 重新执行ArcGIS API安装命令
安装完系统依赖后,回到项目目录,重新运行:
poetry add arcgis
此时gssapi应该能正常完成编译和安装,不会再出现找不到krb5-config的错误。
额外排查步骤(若上述方法无效)
如果安装libkrb5-dev后仍有编译问题,可尝试安装基础编译工具链:
sudo apt install build-essential python3-dev
这些工具能确保Python扩展包编译时的基础环境完整。
内容的提问来源于stack exchange,提问作者MaxDragonheart
相关产品推荐
相关产品推荐

