Reputation: 1
I am trying to run the example given in Notebook 12 of the osmnx-examples GitHub repo.
I used the provided environment.yml with conda to set up my environment:
conda env create -f environment.yml
When I try to run this code block:
raster_path = "./input_data/elevation1.tif"
G = ox.elevation.add_node_elevations_raster(G, raster_path, cpus=1)
I get the error
ImportError: rasterio must be installed as an optional dependency to query rasters.
I have tried including rasterio and gdal in the environment yaml, but it I still get the same error message. I have also tried much Googling for solutions but have not found any.
Upvotes: 0
Views: 28
Reputation: 6442
There was a bug OSMnx fixed recently where you'd get that "rasterio must be installed" error message if the rio-vrt
optional dependency was not installed but you were trying to work with raster files. The initial build of OSMnx 2.0.0 on conda-forge didn't automatically include rio-vrt
, but that conda-forge build and the OSMnx ImportError bug itself have both been fixed.
So, any one of the following should fix your issue at this point:
rio-vrt
into your environmentconda env create -f environment.yml
Upvotes: 0