Note

ImportError: cannot import name '_imaging' with Lambda and M1 Mac

Mar 21, 2021

I use Docker for much of my local development environment. I recently got an M1 MacBook and have switched most development to it. But I need to keep my Intel-based MacBook around for at least one reason: some Python modules for Lamnbda ...

I use Docker for much of my local development environment. I recently got an M1 MacBook and have switched most development to it. But I need to keep my Intel-based MacBook around for at least one reason: some Python modules for Lamnbda do not build properly on the M1 and the Pillow module is emblematic of such. I haven’t delved in to figure out why this happens even using the latest Docker Desktop release candidate for the M1. This is the error that I see in my Cloudwatch logs when trying to deploy a Python application to Lambda with the Serverless framework using Docker on the M1: ImportError: cannot import name '_imaging'