-
Notifications
You must be signed in to change notification settings - Fork 7
Added Layer creation section #24
base: master
Are you sure you want to change the base?
Conversation
I used my use-case, python, as the example to install extra libaries.
Good PR to update the docs 👍 but ... FYI, the notes from #17 (and this PR) were used to create the If those PRs are somehow integrated into the project, this PR might need an update on either how to use the new make rules or extract details from the make rules so this documentation update matches what works in those PRs. Note that the make rules in those PRs change the build PREFIX to use |
docker run --name lambda -itd remotepixel/amazonlinux-gdal:3.0.1 /bin/bash | ||
# This is just an example, installing gdal bindings for python | ||
docker exec -it lambda bash -c 'mkdir python' | ||
docker exec -it lambda bash -c 'pip install gdal==3.0.1 -no-binary :all: -t python -U' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work for py3.6 or py3.7 lambda layers, they need libs to be packaged into
python/lib/python${PY_VERSION}/site-packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...they also output the archived python libs into the correct path for py3.6 and py3.7 shared libs for a lambda layer (it's not
/opt/python
any more, that only works for py2.7).
Are you 100% sure about that? I am currently using a layer, created like I described, using python 3.7. According to AWS' docs, it appears that using only python/
works.
The following part is copied form the above link:
Python – python, python/lib/python3.7/site-packages (site directories)
Example Pillowpillow.zip │ python/PIL └ python/Pillow-5.3.0.dist-info
The package.zip
that I generated has the following format, for python packages:
package.zip
│ python/osgeo
└ python/other_package
etc...
And I can import the packages normally in python. Like so:
from osgeo import gdal
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/shrug - didn't work for me but updates in my MR script are working OK and AFAICT the full path to the python packages in a layer becomes:
/opt/python/lib/python3.7/site-packages/**
- not
/opt/python/{packages_directly_here}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably does become /opt/python/lib/python3.7/site-packages/**
. I was only pointing out that the path, inside the package.zip
, can be /python/your_lib
. AWS probably does some post processing after unzipping the layer package.
docker cp lambda:/tmp/package.zip package.zip | ||
docker stop lambda | ||
docker rm lambda | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, see make rules and scripts in #22
FYI, I'm on holiday right now and trying to stay as far as possible from my laptop. I'll have a look later. |
👋 I've started a PR over #28, I hope to get everything working this week |
I used my use-case, python, as the example to install extra libaries.