4.1.1 - No module named 'Image'

348 views
Skip to first unread message

cql...@gmail.com

unread,
Jan 17, 2021, 11:14:24 PM1/17/21
to weewx-user
Hey all,
I've recently begun the process of migrating my existing weewx install to my
kubernetes cluster, using this base docker image
I'm still getting used to the setup, but it seems to be pulling data from my
weather station and populating my sqlite db. However, I'm running into problems
generating images due to a ModuleNotFoundError. Below, take a look at some of
the results of my troubleshooting.

  • Here's my setup:
root@weewx-84bfc8b796-gwrr7:/home/weewx# python --version
Python 3.9.0
root@weewx-84bfc8b796-gwrr7:/home/weewx# pip --version
pip 20.2.3 from /opt/venv/lib/python3.9/site-packages/pip (python 3.9)
root@weewx-84bfc8b796-gwrr7:/home/weewx# cat version.txt
__version__ = "4.1.1"

Wondering if anybody has navigated this issue before. Thanks!


gjr80

unread,
Jan 17, 2021, 11:37:08 PM1/17/21
to weewx-user
Appreciate you have installed PIL under python3 but are you sure that WeeWX is being run under python3 and not python2? I see nothing in what you have posted that confirms this one way or another. The python version is logged when starting WeeWX. What does the log say when you start WeeWX?

Gary

cql...@gmail.com

unread,
Jan 18, 2021, 5:56:42 AM1/18/21
to weewx-user
Good point. Here are the startup logs - looks like it is running the python version I was expecting: 3.9.0. (Makes sense since the base docker image is a python 3 base image)

cql...@gmail.com

unread,
Jan 18, 2021, 9:47:51 PM1/18/21
to weewx-user
After spending time in the Pillow github issues, I ended up getting this working by installing several packages:

RUN apt-get install zlib1g-dev libjpeg-dev build-essential -y
RUN python -m pip install Pillow

This allows me to install pillow, have it recognized by python, and therefore build my belchertown frontend!

vince

unread,
Jan 18, 2021, 10:11:36 PM1/18/21
to weewx-user
Your underlying issue is that you used a k8s image based on alpine and python3-slim, so it's minimal and doesn't have the build requirements for doing the pip install of Pillow.   That should be somewhat expected.   Unfortunately that's part and parcel of running minimal docker images.  I suspect you might have gotten there a little easier if you just ran a Debian-based base image (since there is already a package for PIL/Pillow you could simply add), but I suspect it would be a much larger Docker image result for your cluster.

Unrelated question - what are you doing in k8s for persistent storage of your archive and public_html trees, as well as for logging ?

cql...@gmail.com

unread,
Jan 18, 2021, 10:17:27 PM1/18/21
to weewx-user
You're absolutely right - and this is the consequence of building off of someone else's docker image! Had I started the process from scratch, I probably would have started with a more fully featured base image.

As for your question, I've set up an nfs share mounted to all 3 pi's, and created a persistent volume for my archive and frontend. While I haven't yet persisted my logs, that's probably a good idea, and wouldn't be too hard. I've only had the cluster up and running for a couple weeks now, so I'm definitely still learning a lot.

vince

unread,
Jan 18, 2021, 10:23:03 PM1/18/21
to weewx-user
On Monday, January 18, 2021 at 7:17:27 PM UTC-8 cql...@gmail.com wrote:
As for your question, I've set up an nfs share mounted to all 3 pi's, and created a persistent volume for my archive and frontend. While I haven't yet persisted my logs, that's probably a good idea, and wouldn't be too hard. I've only had the cluster up and running for a couple weeks now, so I'm definitely still learning a lot.

That's what's always stopped me here.  The cost/pain to have a quality NFS server exceeds the benefit of running kubernetes for me.

Although my quad 4GB pi4 cluster sure runs k3s nicely to say the least :-)

Reply all
Reply to author
Forward
0 new messages