I'm attempting to define an IBM Cloud Function in Python using PIL.
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
img = Image.new('RGB', (width, height))
d = ImageDraw.Draw(img)
...
I use Pycharm to do my development. In Pycharm, under site-packages
in my Python runtime, I see PIL
and Pillow-4.3.0:dist-info
. When I run my code locally from within Pycharm it works fine.
I built a virtualenv
with the same Python runtime and my code in order to include dependencies not part of the Cloud Functions Python runtime. Examining the virtualenv
, I can see the same libraries:
\virtualenv
\bin
\include
\lib
\python3.6
\site-packages
...
\PIL
\Pillow-4.3.0:dist-info
...
However, when I execute my code as a Cloud Function with this virtualenv
runtime, I see an error: ModuleNotFoundError: No module named 'PIL'
.
I'm thinking the error is with how I've constructed my virtualenv
, but I'm at a loss as it looks like the same libraries are there.