Problems using osgeo in Python

If you get this error:

ImportError: cannot import name 'ogr' from 'osgeo'

The most likely cause, assuming you’ve tried to install osgeo directly, is that you installed osgeo from pip and got this package: https://pypi.org/project/osgeo/#history (osgeo-0.0.0-py3-none-any.whl) — which, if you look at it, appears to just be blank files. This won’t go so well.

From what I can tell, the correct solution is to install only what’s necessary via the GDAL package. OSGEO should be included in GDAL. https://pypi.org/project/GDAL/

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s