I am building a python 3.6
AWS Lambda deploy package and was facing an issue with SQLite
.
In my code I am using nltk
which has a
My solution may or may not apply to you (as it depends on Python 3.5), but hopefully it may shed some light for similar issue.
sqlite3
comes with standard library, but is not built with the python3.6 that AWS use, with the reason explained by apathyman
and other answers.
The quick hack is to include the share object .so
into your lambda package:
find ~ -name _sqlite3.so
In my case:
/home/user/anaconda3/pkgs/python-3.5.2-0/lib/python3.5/lib-dynload/_sqlite3.so
However, that is not totally sufficient. You will get:
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
Because the _sqlite3.so
is built with python3.5, it also requires python3.5 share object. You will also need that in your package deployment:
find ~ -name libpython3.5m.so*
In my case:
/home/user/anaconda3/pkgs/python-3.5.2-0/lib/libpython3.5m.so.1.0
This solution is likely not work if you are using _sqlite3.so
that is built with python3.6, because the libpython3.6 built by AWS will likely not support this. However, this is just my educational guess. If anyone has successfully done, please let me know.