[GIS] Rasterio + QGIS – rasterio.drivers() -> TypeError: ‘module’ object is not callable

pyqgisqgisrasterio

I have been trying to get rasterio working with my QGIS setup so that I can take advantage of the fast raster manipulations.

After a day of installing / uninstalling and then piece by piece searching and getting components installed one by one where needed (From upgrading GDAL, numpy, and a whole slew of other modules which were fighting each other) I manged to get to the point where I could import rasterio without any errors.

However now when I run, the first call in the example causes a Traceback:

with rasterio.drivers(CPL_DEBUG=True):  

creates error =>

TypeError: 'module' object is not callable

I have noticed that other rasterio objects seem fine, but all functions that are in .pyc files have this same issue.

Any help? – I will continue in the morning, but I was hoping some elves would appear and help solve this one tonight! 🙂

Best Answer

@AAmes It looks to me that your code is based on out of date examples or docs. Specifically, the rasterio module no longer exports a drivers() function. Please see http://mapbox.github.io/rasterio/quickstart.html for Rasterio 1.0 usage examples.

I'm sorry about the difficulty of integrating Rasterio with QGIS. I haven't tried it myself, but being familiar with the problems of distributing Python C extensions, I'm surprised that you got it to work at all. Normally, Rasterio is installed using pip. I'm not sure what would be required to install it for QGIS's embedded Python.

Related Question