在 ReadTheDocs 上构建文档在要求上完全失败(由于 libgeos)

Build documentation on ReadTheDocs fails on requirement shapely (due to libgeos)

在正确获取 python repository 的文档时,我偶然发现了无法在 ReadTheDocs (RTD) 上安装软件包要求的问题。

日志说:

Searching for shapely
Reading https://pypi.python.org/simple/shapely/
Best match: Shapely 1.6a1
Downloading https://pypi.python.org/packages/83/3b/99d5d0e266c3bf5f361c76ff046a539eaf96a4e9ca1beaef5121dcaf5cdc/Shapely-1.6a1.tar.gz#md5=a2efe87371d8186f5cbeadc0c153c546
Processing Shapely-1.6a1.tar.gz
Writing /tmp/easy_install-7zplo9iy/Shapely-1.6a1/setup.cfg
Running Shapely-1.6a1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7zplo9iy/Shapely-1.6a1/egg-dist-tmp-t5eb3ob8
Failed `CDLL(libgeos_c.so.1)`
Failed `CDLL(libgeos_c.so)`
error: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']

实际问题是 RTD 上缺少 libgeos,而 RTD 需要正常安装。通常,您通过 sudo apt-get install libgeos-dev 安装 libgeos。这不适用于 RTD。

有人对此有任何线索吗?特别是,我正在寻找如何告诉 RTD 安装其他系统包的解决方案。我很好奇这是否可能。

RTD 不支持安装额外的 c 库,如他们在 git 上关于此问题的 FAQs, there's a discussion 中所述。 如常见问题解答中所述,您只能 "mock out" 这些库以避免导入错误。