2017-03-12 7 views
2

ich die folgende Störung erhalte, wennFehler beim Import von geopandas

import geopandas as gpd 

--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-3-f8b81fe8ca07> in <module>() 
----> 1 import geopandas as gpd 

//anaconda/lib/python2.7/site-packages/geopandas/__init__.py in <module>() 
    2 from geopandas.geodataframe import GeoDataFrame 
    3 
----> 4 from geopandas.io.file import read_file 
    5 from geopandas.io.sql import read_postgis 
    6 from geopandas.tools import sjoin 

//anaconda/lib/python2.7/site-packages/geopandas/io/file.py in <module>() 
    1 import os 
    2 
----> 3 import fiona 
    4 import numpy as np 
    5 from shapely.geometry import mapping 

//anaconda/lib/python2.7/site-packages/fiona/__init__.py in <module>() 
67 from six import string_types 
68 
---> 69 from fiona.collection import Collection, BytesCollection, vsi_path 
70 from fiona._drivers import driver_count, GDALEnv 
71 from fiona.drvsupport import supported_drivers 

//anaconda/lib/python2.7/site-packages/fiona/collection.py in <module>() 
    6 import warnings 
    7 
----> 8 from fiona import compat 
    9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator 
10 from fiona.ogrext import Session, WritingSession 

ImportError: cannot import name compat 

Import habe ich geoPandas installiert mit Anaconda jedoch, wenn ich zu laufen Ich versuche es mir den obigen Fehler angezeigt wird. Wenn

läuft
conda list 

Ich erhalte

enter image description here

Nach dem runnning der folgenden Möglichkeiten:

conda install -c conda-forge fiona shapely pyproj rtree 
conda install pandas 
conda install -c conda-forge geopandas 

Ich erhalte

--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-2-f8b81fe8ca07> in <module>() 
----> 1 import geopandas as gpd 

//anaconda/lib/python2.7/site-packages/geopandas/__init__.pyc in <module>() 
    2 from geopandas.geodataframe import GeoDataFrame 
    3 
----> 4 from geopandas.io.file import read_file 
    5 from geopandas.io.sql import read_postgis 
    6 from geopandas.tools import sjoin 

//anaconda/lib/python2.7/site-packages/geopandas/io/file.py in <module>() 
    1 import os 
    2 
----> 3 import fiona 
    4 import numpy as np 
    5 from shapely.geometry import mapping 

//anaconda/lib/python2.7/site-packages/fiona/__init__.py in <module>() 
67 from six import string_types 
68 
---> 69 from fiona.collection import Collection, BytesCollection, vsi_path 
70 from fiona._drivers import driver_count, GDALEnv 
71 from fiona.drvsupport import supported_drivers 

//anaconda/lib/python2.7/site-packages/fiona/collection.py in <module>() 
    7 
    8 from fiona import compat 
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator 
10 from fiona.ogrext import Session, WritingSession 
11 from fiona.ogrext import (

ImportError: dlopen(//anaconda/lib/python2.7/site-packages/fiona/ogrext.so,  

2): Library not loaded: @rpath/libnetcdf.11.dylib 
    Referenced from: //anaconda/lib/libgdal.20.dylib 
    Reason: Incompatible library version: libgdal.20.dylib requires version  

    12.0.0 or later, but libnetcdf.11.dylib provides version 11.0.0 
+0

Könnten Sie versuchen laufen: 'Conda installieren -c Conda-Schmiede fiona formschön pyproj rtree' und ' Conda installieren pandas' und 'Conda installieren -c Conda-Schmiede geopandas' –

+0

Ich habe meine Frage bearbeitet mit die Ausgabe, die ich jetzt erhalte, indem ich ausführe, was du angewiesen hast. – Arshad

+0

Versuchen Sie, eine neue Conda-Umgebung mit minimalen Installationen zu erstellen, um zu sehen, ob sie funktioniert. Ich konnte 'Geopandas' nicht auf meiner 'root'-conda-Installation ausführen, aber es funktionierte auf einer neuen, minimalen' Conda'-Umgebung – cd98

Antwort

2

Die pr Das Problem liegt in der Inkompatibilität der Abhängigkeiten zwischen Fiona und Gdal. Deinstallieren Sie Geopandas über Conda. Es wird auch Fiona deinstallieren. Do conda uninstall geopandas; Do conda install fiona=1.6

Do conda search fiona vor hand und sehen, ob es für Ihre Version von Python verfügbar ist. Wenn nicht, schaffen neue Umgebung für diese Version von Python. (Bsp. create -n py35 python=3.5 anaconda)

Dann pip install geopandas

Schließlich versuchen zu import geopandas und sehen Sie, wenn Sie den Fehler weiterhin erhalten.

+0

Dies liefert keine Antwort auf die Frage. Sobald Sie genügend [Reputation] (http://stackoverflow.com/help/whats-reputation) haben, können Sie [comment] (http://stackoverflow.com/help/privileges/comment) zu jedem Post schreiben. Überprüfen Sie auch dieses [was kann ich stattdessen tun] (https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). – thewaywewere