-
Notifications
You must be signed in to change notification settings - Fork 7
Correct paths resulting package.zip #17
Comments
package.zip
Hi @meyer1994, thanks for the issue. I was looking at lambda layer this week so this is a good reminder that I have to do it for real. maybe you could submit a PR documenting how to create a layer in https://github.com/RemotePixel/amazonlinux-gdal#create-a-lambda-layer
well if you don't use |
Thanks for replying @vincentsarago
I've noticed that. The folder See: $ docker run -it remotepixel/amazonlinux-gdal:3.0.1 /bin/bash
bash-4.2# echo $GDAL_DATA
/var/task/share/gdal Am I doing something wrong? I could not fix this issue :( About the pull request, I can do it, sure. But I think we should resolve the above problem first. The resulting Here is the script that I have used to generate the docker run --name lambda -itd remotepixel/amazonlinux-gdal:3.0.1 /bin/bash
docker exec -it lambda bash -c 'mkdir python'
docker exec -it lambda bash -c 'pip install numpy gdal==3.0.1 rasterio --no-binary numpy,gdal -t python -U'
docker exec -it lambda bash -c 'zip -r9 /tmp/package.zip python'
docker exec -it lambda bash -c 'zip -r9 --symlinks /tmp/package.zip lib/*.so*'
docker exec -it lambda bash -c 'zip -r9 --symlinks /tmp/package.zip lib64/*.so*'
docker exec -it lambda bash -c 'zip -r9 --symlinks /tmp/package.zip bin'
docker exec -it lambda bash -c 'zip -r9 /tmp/package.zip share'
docker cp lambda:/tmp/package.zip package.zip
docker stop lambda
docker rm lambda |
Oh I see you are trying to use GDAL>2.4 that's why rasterio is not happy. rasterio doesn't support GDAL3 yet
|
It seems that Do you think it worth the wait for building the proper documentation? |
I won't be to optimistic with a date, Sean is pretty busy so I'm not sure when this PR will move forward. do we have to ship the layer with rasterio ? @meyer1994 |
oh before I forget, this might break in the lambda layer https://github.com/RemotePixel/amazonlinux-gdal#package-architecture-and-aws-lambda-config |
After doing some tests:Note, I am using GDAL python bindingsTo use it, we must ship the layer with the bindings already installed in it. Inside the container: $ mkdir python
$ pip install -U numpy gdal --no-binary :all: -t python/
$ zip -r9 --symlinks /tmp/package.zip python
$ # ...zip libs and cp package.zip If we do not install the bindings inside the container, we get the following error when importing from
Even setting configs in
Only works when installing directly into the container and using in the layer. RasterioIt is not necessairy to include the |
Maybe is possible to include the python bindings when building GDAL? According to PIP readme:
I have not tested it. |
Yes it's possible but to be honest the goal of this repo is to provide the minimal configuration docker container to create lambda package (either with rasterio or gdal) so I'm not sure I'm going to add any default here. let me see if I have to time to do something this weekend. |
Fair enough. I've only said because I only use gdal with it's python bindings. hehe. |
RE lambda layer:
|
I've just created a PR #24 explaining how to create a layer. |
I had some trouble creating a layer using the script at this repo.
According to AWS documentation, contents of
package.zip
will be extracted to/opt
. So the correct environment variables,GDAL_DATA
, and my inclusion,PROJ_LIB
, should point to/opt/gdal
and/opt/proj
. I have included thePROJ_LIB
variable to avoid theproj.db not found
error.Besides, for the python packages, instead of zipping them to the root address of the zip file, we should zip them to a
python
directory at root level.In the end, it should look like this:
And last, installing
rasterio
with--no-binary
raises the error ofrasterio._shim
module not existing. Installing withpip install rasterio
fixes it. Also, I do not think is necessairy to installrasterio[s3]
becauseboto3
is already included in python Lambdas by default.After doing all the changes I have mentioned above, I've successfully created a layer that I am currently using.
The text was updated successfully, but these errors were encountered: