2

I have installed the whl files for fiona, shapely, gdal, rtree and pyproj. Geopandas is also installed via pip install. But I get the following error when importing it:

import geopandas
Traceback (most recent call last):

  File "<ipython-input-14-c9ee6bd24dbc>", line 1, in <module>
    import geopandas

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\__init__.py", line 1, in <module>
    from geopandas.geoseries import GeoSeries

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geoseries.py", line 12, in <module>
    from geopandas.base import GeoPandasBase, _series_unary_op, _CoordinateIndexer

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\base.py", line 14, in <module>
    from rtree.core import RTreeError

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\__init__.py", line 1, in <module>
    from .index import Rtree

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\index.py", line 5, in <module>
    from . import core

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\core.py", line 116, in <module>
    raise OSError("could not find or load spatialindex_c.dll")

OSError: could not find or load spatialindex_c.dll

and the following error as well:

import fiona
Traceback (most recent call last):

  File "<ipython-input-16-cc872b235141>", line 1, in <module>
    import fiona

  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\__init__.py", line 77, in <module>
    from fiona.collection import Collection, BytesCollection, vsi_path

  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

  File "fiona\ogrext.pyx", line 25, in init fiona.ogrext

ImportError: cannot import name compat

Can somebody please help me here? I'm not being able to figure out how to fix this issue. Thanks and regards.

IndigoChild
  • 842
  • 3
  • 11
  • 29
  • 1
    The first error means that `rtree` cannot find its dependency `libspatialindex`. From its documentation (http://toblerity.org/rtree/install.html) it seems that `rtree` should include that dependency in its binary package (wheels) for Windows. Can you check in the output when installing that is downloaded the wheel for rtree and not the source package? In general, I strongly recommend to use Anaconda / conda to get those packages installed on windows. – joris Nov 05 '18 at 08:48
  • So what rtree mentions on its PyPI page is to use those packages for Windows: https://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree – joris Nov 05 '18 at 08:56
  • Thanks will try. – IndigoChild Nov 05 '18 at 09:01

1 Answers1

0

You could try the installation with conda instead of pip.

conda install -c conda-forge cenpy

See the CenPy documentation: https://pypi.org/project/cenpy/

You don't need to separately install geopandas and Rtree if you use conda.

JCM
  • 365
  • 1
  • 2
  • 15