arpcard/card-live-dashboard

libgeos_c dependency not necessarily installed

fmaguire opened this issue · 1 comments

Running through a dev install (great documentation @apetkau!).

Successful pip install but on attempting to run (card-live-dash-init dev_dir), the libgeos_c library underlying shapley/geopandas doesn't get installed.

  File "/home/fin/miniconda3/envs/card-live/bin/card-live-dash-init", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/fin/Documents/research/bioinformatics/card-live-dashboard/bin/card-live-dash-init", line 13, in <module>
    from card_live_dashboard.service.ConfigManager import ConfigManager
  File "/home/fin/Documents/research/bioinformatics/card-live-dashboard/card_live_dashboard/service/__init__.py", line 4, in <module>
    from card_live_dashboard.service.GeographicRegionCodesService import GeographicRegionCodesService
  File "/home/fin/Documents/research/bioinformatics/card-live-dashboard/card_live_dashboard/service/GeographicRegionCodesService.py", line 5, in <module>
    import geopandas
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/geopandas/__init__.py", line 3, in <module>
    from geopandas.geoseries import GeoSeries  # noqa
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/geopandas/geoseries.py", line 10, in <module>
    from shapely.geometry.base import BaseGeometry
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/shapely/geometry/__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/shapely/geometry/base.py", line 19, in <module>
    from shapely.coords import CoordinateSequence
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/shapely/coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/site-packages/shapely/geos.py", line 81, in <module>
    _lgeos = CDLL(os.path.join(sys.prefix, 'lib', 'libgeos_c.so'))
  File "/home/fin/miniconda3/envs/card-live/lib/python3.9/ctypes/__init__.py", line 382, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /home/fin/miniconda3/envs/card-live/lib/libgeos_c.so: cannot open shared object file: No such file or directory

Even adding geos to the setup.py or explicitly running pip install geos doesn't seem to install this library dependency. Although the conda package of geos does successfully install it.

This error shouldn't occur if you have an underlying system install of libgeos_c as it should fallback out of the env to that but users aren't guaranteed to have that. Not sure there is a simple solution beyond just documenting this is a required system dependency.

Thanks for posting this issue @fmaguire. I hadn't run into this before (I guess I must have had a system install of libgeos_c). I can mention this in my documentation. And maybe condafying this project could also help to avoid this issue. I don't know of any other easier solution though either.