2

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?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
rim zayani
  • 21
  • 1
  • 2
  • 1
    Have you reviewed the rasterio documentation? It looks like it does not have an open function. – PolyGeo Dec 05 '19 at 10:46
  • 1
    I found it in the documentation of rasterio https://rasterio.readthedocs.io/en/stable/topics/reading.html – rim zayani Dec 05 '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 07 '20 at 13:58
  • What versions of python, rasterio and pip are you using? What’s your OS? – ashnair1 Jan 30 '21 at 04:10

2 Answers2

0

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

rdmato33
  • 159
  • 7
0

You first install anaconda navigator, then install required libraries by using conda install in conda prompt.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Adnan
  • 1