System: Mac OSX
Im relatively new user of Python and currently exploring GIS. Trying to read a shape file with geopandas however I am getting: OSError: Could not find libspatialindex_c library file
Using Python 3.7 normally, but since there are dependencies issues with geopandas on this, followed advice here to run on Python2.
What i've done here is with mac terminal, created new environment with python2 and installed geopandas there and tried to read shape file.
conda create -n mytest python=2.7 geopandas -c conda-forge
source activate mytest
import geopandas
geopandas.read_file('Random_points_twitter.shp')
id xcoord ycoord data_twitt
0 0 5.27735 50.25398 0
1 1 3.29896 51.32356 1
2 2 3.29896 51.32356 2
I am successfully able to read this in terminal. But in the browser, it returns me an error.
What I've done was first install jupyter on my new env and got a notebook running on browser(code below)
(mytest) conda install jupyter
(mytest) jupyter-notebook
On browser with the new notebook,tried to import and read the shape file (similar to what i did in terminal) but it gives me this error:
#
OSError Traceback (most recent call last) in () ----> 1 import geopandas
/Users/rldy/anaconda/lib/python2.7/site-packages/geopandas/init.py in () ----> 1 from geopandas.geoseries import GeoSeries 2 from geopandas.geodataframe import GeoDataFrame 3 4 from geopandas.io.file import read_file 5 from geopandas.io.sql import read_postgis
/Users/rldy/anaconda/lib/python2.7/site-packages/geopandas/geoseries.py in () 10 11 from geopandas.plotting import plot_series ---> 12 from geopandas.base import GeoPandasBase, _series_unary_op, _CoordinateIndexer 13 14
/Users/rldy/anaconda/lib/python2.7/site-packages/geopandas/base.py in () 12 13 try: ---> 14 from rtree.core import RTreeError 15 HAS_SINDEX = True 16 except ImportError:
/Users/rldy/anaconda/lib/python2.7/site-packages/rtree/init.py in () ----> 1 from .index import Rtree 2 3 from .core import rt 4 5 version = '0.8.3'
/Users/rldy/anaconda/lib/python2.7/site-packages/rtree/index.py in () 3 import pprint 4 ----> 5 from . import core 6 import ctypes 7 try:
/Users/rldy/anaconda/lib/python2.7/site-packages/rtree/core.py in () 123 124 if lib_name is None: --> 125 raise OSError("Could not find libspatialindex_c library file") 126 127 rt = ctypes.CDLL(lib_name)
OSError: Could not find libspatialindex_c library file
#
My conda list (below) already has libspatial installed yet when running on Jupyter Notebook using browser gives me this error. Any ideas?
backports: 1.0-py27_1 conda-forge
backports.functools_lru_cache: 1.4-py27_1 conda-forge
backports_abc: 0.5-py27_0 conda-forge
ca-certificates: 2017.11.5-0 conda-forge
certifi: 2017.11.5-py27_0 conda-forge
clangdev: 5.0.0-default_0 conda-forge
click: 6.7-py_1 conda-forge
click-plugins: 1.0.3-py27_0 conda-forge
cligj: 0.4.0-py27_0 conda-forge
curl: 7.55.1-0 conda-forge
cycler: 0.10.0-py27_0 conda-forge
descartes: 1.1.0-py27_0 conda-forge
enum34: 1.1.6-py27_1 conda-forge
expat: 2.2.5-0 conda-forge
fiona: 1.7.9-py27_0 conda-forge
freetype: 2.8.1-0 conda-forge
freexl: 1.0.4-0 conda-forge
functools32: 3.2.3.2-py27_1 conda-forge
geopandas: 0.3.0-py27_0 conda-forge
geos: 3.6.2-1 conda-forge
geotiff: 1.4.2-1 conda-forge
giflib: 5.1.4-0 conda-forge
hdf4: 4.2.13-0 conda-forge
hdf5: 1.10.1-1 conda-forge
icu: 58.2-0 conda-forge
intel-openmp: 2018.0.0-h8158457_8
jpeg: 9b-2 conda-forge
json-c: 0.12.1-0 conda-forge
kealib: 1.4.7-4 conda-forge
krb5: 1.14.2-0 conda-forge
libcxx: 5.0.0-0 conda-forge
libdap4: 3.18.3-2 conda-forge
libgdal: 2.1.4-9 conda-forge
libgfortran: 3.0.1-h93005f0_2
libiconv: 1.15-0 conda-forge
libnetcdf: 4.4.1.1-10 conda-forge
libpng: 1.6.34-0 conda-forge
libpq: 9.6.3-0 conda-forge
libspatialindex: 1.8.5-1 conda-forge
libspatialite: 4.3.0a-19 conda-forge
libssh2: 1.8.0-2 conda-forge
libtiff: 4.0.9-0 conda-forge
libxml2: 2.9.7-0 conda-forge
llvmdev: 5.0.0-default_0 conda-forge
matplotlib: 2.1.2-py27_0 conda-forge
mkl: 2018.0.1-hfbd8650_4
munch: 2.2.0-py27_0 conda-forge
ncurses: 5.9-10 conda-forge
numpy: 1.14.0-py27h8a80b8c_1
openjpeg: 2.3.0-2 conda-forge
openssl: 1.0.2n-0 conda-forge
pandas: 0.22.0-py27_0 conda-forge
pcre: 8.39-0 conda-forge
pip: 9.0.1-py27_1 conda-forge
proj4: 4.9.3-5 conda-forge
psycopg2: 2.7.3.2-py27_0 conda-forge
pyparsing: 2.2.0-py27_0 conda-forge
pyproj: 1.9.5.1-py27_0 conda-forge
pysal: 1.14.3-py27_0 conda-forge
python: 2.7.14-4 conda-forge
python-dateutil: 2.6.1-py27_0 conda-forge
pytz: 2017.3-py_2 conda-forge
readline: 7.0-0 conda-forge
rtree: 0.8.3-py27_0 conda-forge
scipy: 1.0.0-py27h793f721_0
setuptools: 38.4.0-py27_0 conda-forge
shapely: 1.6.4-py27_0 conda-forge
singledispatch: 3.4.0.3-py27_0 conda-forge
six: 1.11.0-py27_1 conda-forge
sqlalchemy: 1.2.1-py27_0 conda-forge
sqlite: 3.20.1-2 conda-forge
ssl_match_hostname: 3.5.0.1-py27_1 conda-forge
subprocess32: 3.2.7-py27_0 conda-forge
tk: 8.6.7-0 conda-forge
tornado: 4.5.3-py27_0 conda-forge
wheel: 0.30.0-py27_2 conda-forge
xerces-c: 3.2.0-0 conda-forge
xz: 5.2.3-0 conda-forge
zlib: 1.2.11-0 conda-forge