Search code examples
pythonshapelyread-the-docs

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


While getting the documentation of a python repository right, I stumpled upon the issue that the package requirement shapely cannot be install on ReadTheDocs (RTD).

The log says:

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']

The actual problem is that libgeos is missing on RTD which is required to install shapely. Usually, you install libgeos by sudo apt-get install libgeos-dev. This does not work on RTD.

Does someone has any clue on that? In particular, I'm looking for a solution how to tell RTD to install additional system packages. I'm curious if this is possible at all.


Solution

  • RTD does not support installing additional c libs as stated in their FAQs, there's a discussion about this issue on git. As written in the FAQ, you can only "mock out" these libs to avoid import errors.