I've looked around but have had a hard time finding someone with a similar problem. Most of the articles I come across have a hard time deploying a package. My problem is that the package I uploaded has a hard time finding its resources.
For more context: I am using python3, I have used both RedHat 7 and Windows 10 to follow these instructions to create the layer I need, and I have successfully been able to follow them to create a layer and import it into my lambda_function.py file. The module I am trying to import is called qrcode. When the virtual environment is activated, I installed it with pip install qrcode[pil]
on Windows 10 and pip3 install qrcode[pil]
on my RedHat 7 ec2 instance. I have also tried to include a separate layer for pil itself, to which it still didn't work.
The error: The stacktrace is as follows -
{
"errorMessage": "No module named 'Image'",
"errorType": "ModuleNotFoundError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 30, in lambda_handler\n img = qrcode.make(data)\n",
" File \"/opt/python/qrcode/main.py\", line 13, in make\n return qr.make_image()\n",
" File \"/opt/python/qrcode/main.py\", line 296, in make_image\n from qrcode.image.pil import PilImage\n",
" File \"/opt/python/qrcode/image/pil.py\", line 7, in <module>\n import Image\n"
]
}