I've been trying to create a layer for Lambda that would allow me to use shapely for runtime python 3.9. For some reason lambda just keeps returning the error:
lambda_function': No module named 'shapely.lib
So there's probably something wrong with my .zip file. Ive installed in path shapely.zip/python/..
Here's what Ive done so far:
Looked for dependencies and ended up zipping up together in a python3 venv: shapely, geos, pyproj and numpy like this:
mkdir python
python3 -m venv env
source env/bin/activate
cd python
pip3 install shapely -t python
pip3 install geos -t python
pip3 install numpy -t python
pip3 install pyproj -t python
zip -r shapely.zip python
I also tried pip install shapely
, but that returned Nothing to do
.
Tried altinstalling python 3.9 on an ec2 (with amazon linux 2) and running it in virtual environment, but the ec2 keeps telling me that python3.9 is an unknown command. Ive had to fight with layers before but this seems to be the most notorious so far.
I also noticed that by running "pip3 install geos", I it probably installed a wrong version, so I tried to install a tar.bz2 for geos 3.9 and install it like with what I found from the internet:
wget http://download.osgeo.org/geos/geos-3.9.0.tar.bz2
tar xvfj geos-3.9.0.tar.bz2
cd geos-3.9.0
./configure
make
sudo make install
But that gave me this weird error:
`/bin/mkdir -p '/usr/local/lib'
'/bin/sh ../libtool --mode=install /bin/install -c libgeos.la
'/usr/local/lib'`
`libtool: install: 'libgeos.la' is not a valid libtool archive'`
`libtool: install: Try 'libtool --help --mode=install' for more
information.`
`make[4]: *** [install-libLTLIBRARIES] Error 1`
`make[4]: Leaving directory '/usr/python/python/geos-3.9.0/src'`
`make[3]: *** [install-am] Error 2`
`make[3]: Leaving directory '/usr/python/python/geos-3.9.0/src'`
`make[2]: *** [install-recursive] Error 1`
`make[2]: Leaving directory '/usr/python/python/geos-3.9.0/src'`
`make[1]: *** [install-recursive] Error 1`
`make[1]: Leaving directory '/usr/python/python/geos-3.9.0'`
`make: *** [install] Error 2`
I even found a suggestion from the libgeos website to install it via
sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras enable epel
sudo yum search geos
sudo yum install geos geos-devel
but that returned that there was nothing to install from the extras that would be "geos" or "geos-devel".
Has anyone successfully created one or got any suggestions I could try?