I'm using GDAL v2.14 on my Windows 10 machine. In that environment, I have two gdal python bindings. One is import gdal, the other is import osgeo. I installed Python's gdal using http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal.

On my Ubuntu server, there are two ways to install gdal. One is to do sudo apt-get install python-gdal and the other is pip install gdal (but you need the C headers for this install).

On my Windows install, I can use gdal.Warp() to warp a projection, or crop it. On Ubuntu, this fails with the error AttributeError: 'module' object has no attribute 'Warp' on both "installations" of gdal. How can I make it cross-platform while also maintaining the same functionality?

1 Answer 1


The problem I was having was that my GDAL installation was version 1.11 (latest version on Ubuntu ppa due to the new major version) when my Windows installation was 2.1.4. I fixed that using these steps:

Download GDAL's source using https://trac.osgeo.org/gdal/wiki/DownloadSource. I picked 2.1.4. I then ran:

$ cd gdal-2.1.4/
$ ./configure --prefix=/usr/
$ make
$ sudo make install
$ cd swig/python/
$ sudo python setup.py install

It also turns out that import gdal and from osgeo import gdal are the same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.