Spark上的Bluemix:!pip install --user shapely ==无法找到库geos_c或加载其任何变体

时间:2016-06-30 16:28:25

标签: apache-spark ibm-cloud

!pip install --user shapely

结果

Collecting shapely
  Using cached Shapely-1.5.16.tar.gz
    Complete output from command python setup.py egg_info:
    Failed `CDLL(libgeos_c.so.1)`
    Failed `CDLL(libgeos_c.so)`
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/gpfs/global_fs01/sym_shared/YPProdSpark/user/s390-a2b719b24f799b-80b3d8dd92c1/notebook/tmp/pip-build-PYROZS/shapely/setup.py", line 38, in <module>
        from shapely._buildcfg import geos_version_string, geos_version, \
      File "shapely/_buildcfg.py", line 167, in <module>
        fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
      File "shapely/_buildcfg.py", line 161, in load_dll
        libname, fallbacks or []))
    OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']

如何在Bluemix Spark服务中解决此问题,我没有管理员权限来安装库。

有很多类似的问题,但没有一个是关于Bluemix Spark服务的。

1 个答案:

答案 0 :(得分:1)

这对我有用:

!wget http://download.osgeo.org/geos/geos-3.5.0.tar.bz2
!tar jxf geos-3.5.0.tar.bz2
!cd geos-3.5.0 && ./configure --prefix=$HOME/geos-bin && make && make install
!GEOS_CONFIG=$HOME/geos-bin/bin/geos-config pip install --user shapely
...
output omitted for brevity
...
Collecting shapely
  Using cached Shapely-1.5.16.tar.gz
Installing collected packages: shapely
  Running setup.py install for shapely ... [?25l- \ | / - \ | / - done
[?25hSuccessfully installed shapely-1.5.16