I am new to rasterio. I'm trying to open a tif file using this code:

import rasterio
dataset= rasterio.open('/home/zaianir/Documents/DB/serie_temporelle_s2/serie_temporelle_s2/Sentinel2_T31TCJ_MASKS.tif')

But I get this error:

AttributeError: module 'rasterio' has no attribute 'open'

How do I avoid this error?

  • 1
    Have you reviewed the rasterio documentation? It looks like it does not have an open function. – PolyGeo Dec 5 '19 at 10:46
  • 1
    I found it in the documentation of rasterio rasterio.readthedocs.io/en/stable/topics/reading.html – rim zayani Dec 5 '19 at 13:40
  • Rasterio does have an open function. Please double check your file path. Also make sure you have a good install of rasterio. Does import rasterio work? If these do not yield results, try a fresh install in a conda environment. – Aaron Jan 7 at 13:58

I had this error two weeks ago. I installed rasterio 1.0.21 with conda (not with pypi). Now, rasterio.open("_.tif") works.

|improve this answer|||||

Your Answer

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

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