I'm trying to run a Python program which needs to import

from osgeo import gdal, ogr
import osgeo.ogr, osgeo.osr
from osgeo.gdalconst import *

But when I run it outputs

Traceback (most recent call last):
  File "./lisbon_P2M.py", line 8, in <module>
    from osgeo import gdal, ogr
ImportError: No module named 'osgeo'

Meanwhile, I tried to install osgeo but it pops this error:

sudo apt-get install libgeos-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 libgeos-dev : Depends: libgeos-c1v5 (= 3.5.0-1ubuntu2) but 3.5.1-3~xenial0 is to be installed
E: Unable to correct problems, you have held broken packages.

Any hints on how this can be solved ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.