Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

Added Layer creation section #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added Layer creation section #24

wants to merge 1 commit into from

Conversation

meyer1994
Copy link

I used my use-case, python, as the example to install extra libaries.

I used my use-case, python, as the example to install extra libaries.
@dazza-codes
Copy link

dazza-codes commented Aug 10, 2019

Good PR to update the docs 👍 but ...

FYI, the notes from #17 (and this PR) were used to create the Makefile rules in PRs:

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 /opt instead (so the shared-libs linking should link to the right paths), 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).

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'

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

Copy link
Author

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 Pillow

pillow.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
...

Copy link

@dazza-codes dazza-codes Aug 12, 2019

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}

Copy link
Author

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
```
Copy link

@dazza-codes dazza-codes Aug 10, 2019

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

@vincentsarago
Copy link
Member

FYI, I'm on holiday right now and trying to stay as far as possible from my laptop. I'll have a look later.

@vincentsarago
Copy link
Member

👋 I've started a PR over #28, I hope to get everything working this week

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants