3

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.

Karthik
  • 2,181
  • 4
  • 10
  • 28
Juan Nolazco
  • 85
  • 2
  • 6

3 Answers3

6

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).

datalowe
  • 589
  • 2
  • 7
1

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

Juan Nolazco
  • 85
  • 2
  • 6
Gautamrk
  • 1,144
  • 9
  • 12
0

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.

Fortfanop
  • 41
  • 1
  • 1
  • 5