When I try to import geopandas package in "Google Colaboratory" I got the error "ModuleNotFoundError: No module named 'geopandas'".
I will appreciate your help. Thanks in advance.
When I try to import geopandas package in "Google Colaboratory" I got the error "ModuleNotFoundError: No module named 'geopandas'".
I will appreciate your help. Thanks in advance.
Colaboratory comes with some non-base-Python packages "pre-installed"/already available for import. It doesn't include every single package however. For packages that aren't already included, like geopandas
, you need to add a cell for installing the package:
% pip install geopandas
Run this cell before any cells where you want to import/use geopandas.
See also this SO thread (especially the answer by Doug Blank, a bit further down).
Check if geopandas is installed
>>> import sys
>>> 'geopandas' in sys.modules
To install the released version, you can use pip (in Google Colab, do not forget to include character ! before pip):
!pip install geopandas
Here is the notebook with only installing Gdal, geopandas and descartes to work ploting and spatial join. Geopandas Colab
Try running !pip install geopandas
in a new cell.
Don't forget the !
Exclamation mark.
Note:
This method works for other libraries too.
Simply !pip install 'package_name'
If you are running Python on your local machine, then open up Command Line and type pip install 'package_name'
to install a package.