abjer / sds

Social Data Science - a summer school course
https://abjer.github.io/sds
18 stars 34 forks source link

Anyone using geopandas? #23

Closed NadineSahin closed 6 years ago

NadineSahin commented 6 years ago

Is anyone using Geopandas and want to share information on how to install it properly and import it?

I am trying to install geopandas with: pip install geopandas it installs correctly, but when importing it using import geopandas as gpd

I get this error:

ImportError Traceback (most recent call last)

in () ----> 1 import geopandas as gpd ~\Anaconda3\lib\site-packages\geopandas\__init__.py in () 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 ~\Anaconda3\lib\site-packages\geopandas\io\file.py in () 1 import os 2 ----> 3 import fiona 4 import numpy as np 5 import six ~\Anaconda3\lib\site-packages\fiona\__init__.py in () 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 ~\Anaconda3\lib\site-packages\fiona\collection.py in () 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: DLL load failed: Det angivne modul blev ikke fundet.
kristianolesenlarsen commented 6 years ago

Geopandas should not be installed with pip for technical reasons.

http://geopandas.org/install.html

abjer commented 6 years ago

@NadineSahin did you manage to solve this? Otherwise I'm in my office tomorrow morning.

kristianolesenlarsen commented 6 years ago

For those of you in need of shapefiles for danish municipalities: They can be downloaded here:

https://github.com/FrederikTomPetersen/adm

Viola0 commented 6 years ago

I get the same error. I used: conda install -c conda-forge geopandas

abjer commented 6 years ago

@Viola0 did you solve this? It sounds like you have a previous version that you installed via pip which causes the malfunction.

Vordingborg commented 6 years ago

When using geopandas and sucesfully created a geodataframe and now want to plot areas of the map by concentration of say population. How should we do it? Any good ideas?

Viola0 commented 6 years ago

@abjer I still havn't solved it. I didn't use pip the first time (but I tried it afterwards) so I don't think that's the problem. I've talked to another group, where they were only able to import geopandas on one computer after the installation, so it seems like it's a pretty normal problem..

Viola0 commented 6 years ago

@abjer according to this discussion https://github.com/geopandas/geopandas/issues/237 it should help to install it in a new environment, but I can't figure out how that works

abjer commented 6 years ago

@Viola0

You need to open your command prompt / terminal where you have access to conda. Then you need to

  1. create the environment
  2. activate the environment
  3. install relevant packages, e.g.
    • conda install -c conda-forge geopandas jupyter scipy scikit-learn seaborn -y
  4. while the environment is still active, add the jupyter kernel using
    • python -m ipykernel install --user
  5. start jupyter notebook again - now under new it should have the possibility of making a notebook using your new environment