Some libraries like Pillow are deprecated and they are forked for the community to still upgrading them. The problem is the os base that runs python in aws, because they do not use forked libraries. For that, aws creates layers (not only for that but I will not explain that now) for lambdas and you can create one with your own resources on a specific os and specific version of your programming language ( in this case python) and put layers into your lambda and so you can run Pillow or another libraries with the same problem.
To create layers you need knowledge of docker and scripts for linux...
but why we will create water with sugar if it already exist?
In this repository: https://github.com/keithrozario/Klayers
you have a lot of layer that you can use.
I give you an example of how add one layer when you have a problem with Pillow.
In this lambda I need to use PIL because I use aws Recognition text and I manage Image object to draw squares and other things. If you see I have the same error:
(I can't post images :( so here is the link)
https://i.stack.imgur.com/pmptW.jpg
The next we need to do is erase the libraries, because we don't need that in the base code of the lambda for the reasons I was explained in the start of this article.
Your lambda now need to seem like that:
https://i.stack.imgur.com/rMGhk.jpg
Now, depend of your python version or your region in aws you will search in the repository the specific arn of the layer that you will need to use [https://github.com/keithrozario/Klayers/blob/master/deployments/python3.8/arns/us-east-1.csv]. In my case is python 3.8 and us-east-1 region.
https://i.stack.imgur.com/qHXJX.jpg
In this case the arn is :
arn:aws:lambda:us-east-1:770693421928:layer:Klayers-python38Pillow:5
Go to your lambda to this part and click on layers:
https://i.stack.imgur.com/O5Ejg.jpg
You will see this:
https://i.stack.imgur.com/RRRPE.jpg
Click in add layer-> Specified arn -> paste the arn
https://i.stack.imgur.com/Up6ek.jpg
And that's all, now your lambda function will run fine.
(deploy and test)
https://i.stack.imgur.com/rMGhk.jpg