Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named geopandas

Tags:

python

I just ran this code and got this error, I'm not sure why:

%matplotlib inline
​
import seaborn as sns
import pandas as pd
import pysal as ps
import geopandas as gpd
import numpy as np
import matplotlib.pyplot as pet

ImportError: No module named geopandas

like image 256
Fan Wu Avatar asked Dec 07 '16 04:12

Fan Wu


People also ask

How do you use Geopandas on Google Colab?

To make it very simple, I simply do the following three tasks: read a shape file of countries with population and gdp data and a vector file of capitals from geopandas datasets; plot a world map shaded by GDP per capita with a scale bar; and.


2 Answers

You might encounter this problem even if geopandas is correctly installed in your active environment. Your problem might be related to ipython not being installed in the environment you installed geopandas in. In this case ipython from outside of the environment is used and will find no module named geopandas resulting in a ImportError.

Assuming a Linux OS:

  • You can check which ipython is used with where ipython.
  • You can install ìpython in your active environment by executing conda install ipython.
like image 64
marianoju Avatar answered Oct 26 '22 00:10

marianoju


If you have any trouble installing GeoPandas, just follow the below steps:

⦁ Go to Unofficial Windows Binaries for Python Extension Packages. (https://www.lfd.uci.edu/~gohlke/pythonlibs/)

⦁ Download the following binaries in a specifi folder in your laptop/PC:

GDAL,

Pyproj,

Fiona,

Shapely &

Geopandas

matching the version of Python, and whether the 32-bit or 64-bit OS is installed on your laptop. (E.g. for Python v3.8x (64-bit), GDAL package should be GDAL-3.3.2-cp38-cp38-win_amd64.whl)

Go to the folder where the binaries are downloaded in the command prompt window. (C:\Users\abc\GeoPandas dependencies) Order of execution of the following commands matter.

pip install .\GDAL-3.3.2-cp38-cp38-win_amd64.whl

pip install .\pyproj-3.2.0-cp38-cp38-win_amd64.whl

pip install .\Fiona-1.8.20-cp38-cp38-win_amd64.whl

pip install .\Shapely-1.7.1-cp38-cp38-win_amd64.whl

pip install .\geopandas-0.9.0-py3-none-any.whl

Credit

like image 45
mpriya Avatar answered Oct 25 '22 22:10

mpriya