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
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.
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:
ipython
is used with where ipython
.ìpython
in your active environment by executing conda install ipython
.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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With