0

When I'm trying to import rasterio in AWS Lambda I receive the following error:

Unable to import module 'lambda_function': No module named 'rasterio._base'

At first, I received the following error:

Unable to import module 'lambda_function': No module named 'rasterio'

So I tried to pip install the module, compressed it into a zip, and upload it as a layer(I did the same for the requests module and it worked just fine), but now I'm getting:

Unable to import module 'lambda_function': No module named 'rasterio._base'

I've also tried:

  • Creating an empty virtual environment -> pip installing rasterio -> compressing the module.
  • Installing different versions of rasterio

When I try to import rasterio._base through the CLI it works, but for some reason it fails to compile in the lambda.

Any suggestions?

Lazloo Xp
  • 858
  • 1
  • 11
  • 36

1 Answers1

0

use rasterio-lambda-layer - see https://github.com/addresscloud/rasterio-lambda-layer

balderman
  • 22,927
  • 7
  • 34
  • 52