简体   繁体   中英

Is there a way to fix this import error for geopandas?

I am trying to get GemGIS to work. During the installation process I installed the libaries geopandas and gemgis in my enviroment through:

conda install -c conda-forge geopandas

and

pip install gemgis

I used the anaconda powershell and everything seemed okay. When I started jupyter lab and tried to import those packages I got the following error code:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-24-a62d01c1d62e> in <module>
----> 1 import geopandas as gpd

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\__init__.py in <module>
----> 1 from geopandas._config import options  # noqa
      2 
      3 from geopandas.geoseries import GeoSeries  # noqa
      4 from geopandas.geodataframe import GeoDataFrame  # noqa
      5 from geopandas.array import points_from_xy  # noqa

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in <module>
    124 use_pygeos = Option(
    125     key="use_pygeos",
--> 126     default_value=_default_use_pygeos(),
    127     doc=(
    128         "Whether to use PyGEOS to speed up spatial operations. The default is True "

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in _default_use_pygeos()
    110 
    111 def _default_use_pygeos():
--> 112     import geopandas._compat as compat
    113 
    114     return compat.USE_PYGEOS

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_compat.py in <module>
    147 RTREE_GE_094 = False
    148 try:
--> 149     import rtree  # noqa
    150 
    151     HAS_RTREE = True

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\__init__.py in <module>
      7 __version__ = '0.9.7'
      8 
----> 9 from .index import Rtree, Index  # noqa

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\index.py in <module>
      4 import pprint
      5 
----> 6 from . import core
      7 
      8 import pickle

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\core.py in <module>
     73 
     74 # load the shared library by looking in likely places
---> 75 rt = finder.load()
     76 
     77 rt.Error_GetLastErrorNum.restype = ctypes.c_int

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\finder.py in load()
     65             finally:
     66                 os.environ['PATH'] = oldenv
---> 67         raise OSError("could not find or load {}".format(lib_name))
     68 
     69     elif os.name == 'posix':

OSError: could not find or load spatialindex_c-64.dll
'''

Does anyone know how to fix this? I looked up the paths and saw, that the core.py data had similar codes as requested, but the **64** was missing at the end of the spatialindex_c-.dll 

Your installation of rtree is corrupted. You can either try reinstalling it or using pygeos instead.

The recommended way (since I see that you're using conda):

conda install rtree -c conda-forge

or

conda install pygeos -c conda-forge

With pygeos, rtree is not used, hence won't raise an error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM