RemotePixel / amazonlinux

Create Geospatial ready AWS lambda layer and docker image
MIT License
12 stars 3 forks source link

Cannot import fiona. Urecognized symbol OSRFixup #3

Closed meyer1994 closed 5 years ago

meyer1994 commented 5 years ago

I've created a layer using the script. It throws an error when trying to import fiona.

[ERROR] Runtime.ImportModuleError: Unable to import module 'app': /opt/python/fiona/ogrext.cpython-37m-x86_64-linux-gnu.so: undefined symbol: OSRFixup

I've created this layer using the script in the scripts directory. I used this image:

remotepixel/amazonlinux:gdal3.0-py3.7-full

To create the error I used a simple chalice lambda function:

import subprocess

# Testing imports
import fiona
import rasterio
import shapely
from osgeo import gdal, ogr, osr

from chalice import Chalice

app = Chalice(app_name='test')

@app.lambda_function()
def index(event, context):
    # Testing bin
    result = subprocess.run(['gdalinfo', '--formats'])
    assert result.returncode == 0
    return {'it': 'worked'}

Everything works fine when removing the fiona import.

Edit:

I've just read that fiona does not yet support gdal 3. So there is the problem. But, rasterio works and it does not support it yet aswell. Any ideas how to fix?

meyer1994 commented 5 years ago

When using the other 2.4.2 version it works correctly.

vincentsarago commented 5 years ago

thanks for the report @meyer1994 I didn't know that fiona didn't support GDAL 3.0 yet sorry about that. I'll make a note (or remove fiona)

vincentsarago commented 5 years ago

removed fiona from the layer for now