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! :-)

1 Answer 1


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

  • Thanks for the note the drivers() function I took directly from the example that I found. It looks like it was outdated!! I am now running into a new problem (Which does not have me at a brick wall as I was before.. and I will keep at it!) I am now seeing this error repeating: Traceback (most recent call last): File "C:\QGIS\apps\Python27\lib\logging_init_.py", line 875, in emit self.flush() File "C:\QGIS\apps\Python27\lib\logging_init_.py", line 835, in flush self.stream.flush() IOError: [Errno 9] Bad file descriptor Logged from file env.py, line 160
    – A.A
    Commented Dec 7, 2016 at 19:15
  • As a note of installing it with QGIS - I'll claim success once it is working! I have seen evidence that there are some people out there who have gotten it to work. Rasterio is a amazingly powerful module which would vastly accelerate the functionality of working on rasters inside of pyQGIS. I installed everything using the lfd.uci.edu/~gohlke/pythonlibs python wheels. It took some work to get pip up and wheel up and running but systematically going through all of the dependencies with a pip install dependency --upgrade seemed to get me a long ways (got me to import XX)
    – A.A
    Commented Dec 7, 2016 at 19:22
  • oh and this is the location of the BAD example! pypi.python.org/pypi/rasterio/0.5.1
    – A.A
    Commented Dec 7, 2016 at 19:44

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.