Closed ghost closed 1 year ago
I do have the same issue, running a normal Linux installation.
I needed to install Cheetah3 within the image manually to get it working. Maybe this is because you changed from python alpine to slim?
Hey @felddy and others, did you ever solve this? I've just spent a few minutes on this but wasn't able to get it working with the multi-stage approach.
The following diff represents what I ended up with. It's not a satisfying solution but maybe it helps others while we figure out how to solve this is a better way :) Best!
diff --git a/Dockerfile b/Dockerfile
index b61a104..526132f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,13 +2,14 @@ FROM python:3-alpine as stage-1
ARG WEEWX_UID=421
ENV WEEWX_HOME="/home/weewx"
-ENV WEEWX_VERSION="4.4.0"
+ENV WEEWX_VERSION="4.5.1"
ENV ARCHIVE="weewx-${WEEWX_VERSION}.tar.gz"
RUN addgroup --system --gid ${WEEWX_UID} weewx \
&& adduser --system --uid ${WEEWX_UID} --ingroup weewx weewx
RUN apk --no-cache add tar
+#RUN apk --no-cache add py3-pillow zlib-dev jpeg-dev build-base
WORKDIR /tmp
COPY src/hashes requirements.txt ./
@@ -26,6 +27,7 @@ RUN chown -R weewx:weewx ${WEEWX_HOME}
# Python setup
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
+RUN pip install --no-cache wheel
RUN pip install --no-cache --requirement requirements.txt
WORKDIR ${WEEWX_HOME}
@@ -34,12 +36,17 @@ RUN bin/wee_extension --install /tmp/weewx-mqtt.zip
RUN bin/wee_extension --install /tmp/weewx-interceptor.zip
COPY src/entrypoint.sh src/version.txt ./
-FROM python:3-slim as stage-2
+FROM python:3 as stage-2
ARG TARGETPLATFORM
ARG WEEWX_UID=421
ENV WEEWX_HOME="/home/weewx"
-ENV WEEWX_VERSION="4.4.0"
+ENV WEEWX_VERSION="4.5.1"
# For a list of pre-defined annotation keys and value types see:
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
@@ -55,9 +62,15 @@ RUN apt-get update && apt-get install -y libusb-1.0-0 gosu busybox-syslogd tzdat
WORKDIR ${WEEWX_HOME}
-COPY --from=stage-1 /opt/venv /opt/venv
+#COPY --from=stage-1 /opt/venv /opt/venv
COPY --from=stage-1 ${WEEWX_HOME} ${WEEWX_HOME}
+RUN pip install --no-cache wheel setuptools
+RUN pip install --no-cache configobj paho-mqtt pyserial pyusb
+RUN pip install --no-cache Cheetah3
+RUN pip install --no-cache Pillow
+
RUN mkdir /data && \
cp weewx.conf /data
diff --git a/src/hashes b/src/hashes
index 69e40eb..2945e6d 100644
--- a/src/hashes
+++ b/src/hashes
@@ -1,3 +1,3 @@
-4ad1f8ff990ce86d80b3bc5448d5545e67e8b42ac14fc6a041b7734740e846c5 weewx-4.4.0.tar.gz
+9650f9a4ce0f300a652d926820bc5b683a1826fd668c0e71413e88c772d7f056 weewx-4.5.1.tar.gz
9580cc3e3d617d20ffc42138712634850f37716a1257e9da0516407970765813 weewx-mqtt.zip
6229d493acd051730530ab50c235f57cc7f9c53dc1a8060c7b6e4817dd2bf66d weewx-interceptor.zip
I have this issue also. Could you please let me know how I can resolve it. Many thanks Thanks for the smiley. Would be nice if you could help me
I have this issue too. fedora 35.
A possible solution is using felddy/weewx
as a base for your own image where the dependencies/libraries you need have been preinstalled. Here is an example that I'm using where I wanted mysql support, html report support, and the weewx-weatherlink-live
driver. This formula has worked for me and may solve the issues that others have seen around missing python libraries.
FWIW I think it'd make sense to "upstream" some of this into the main felddy/weewx
image - for example it probably wouldn't hurt to include the mysql support and common HTML rendering libraries "out of the box".
Quick explanation of what's going on in the below steps:
weewx-weatherlink-live
driver and then exiting. In theory this could be done in the main felddy/weewx
image but I didn't think it made sense to install curl
just for this one thing. This is only relevant for people who have a Davis WeatherLink Live and so it arguably isn't needed in the main felddy/weewx
image.apt-get
:
libmariadb-dev-compat
for weewx mysql supportgcc
, for pip install mysqlclient
to work (then uninstalled afterwards)weewx-weatherlink-live
driver that I'm using, and for HTML rendering to work (note: the preceding cd
command into the venv is required or else the pip
command for whatever reason doesn't actually install anything - this took hours to figure out):
MySQLdb
for weewx mysql supportrequests
as required by weewx-weatherlink-live
Cheetah3
and Pillow
as required for generating HTML reports (I'm just using Seasons right now)gcc
again as it's no longer needed after the pip install
has completed (avoids wasting space in the final image)python -c
import statement as a sanity check that the libraries installed. If you add other libraries to the pip install
command, it'd make sense to add them to this import
statement to check that they actually work as part of the image build.wee_extension --install
to install the downloaded weatherlink-live driver package that was copied over from the first image, then removes the redundant package file.FROM docker.io/library/debian:bullseye-slim
# weewx image doesn't have curl/wget so just download from separate stage
ENV EXTENSION_VERSION=v1.0.11
RUN apt-get update \
&& apt-get install -y curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives \
&& curl \
-Lo /tmp/weewx-weatherlink-live.tar.xz \
https://github.com/michael-slx/weewx-weatherlink-live/releases/download/${EXTENSION_VERSION}/weewx-weatherlink-live-${EXTENSION_VERSION}.tar.xz
FROM docker.io/felddy/weewx:4.5.1
COPY --from=0 /tmp/weewx-weatherlink-live.tar.xz /tmp/weewx-weatherlink-live.tar.xz
# - install prerequisites for running pip install
# - install needed python packages to venv via pip (apt-get installs to host)
# note that CD TO SITE-PACKAGES IS REQUIRED because pip just installs to cwd for some reason
# - uninstall gcc after completing pip install
# - install weatherlink-live extension
RUN apt-get update \
&& apt-get install -y gcc libmariadb-dev-compat \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives \
&& which pip \
&& cd /opt/venv/lib/python3.10/site-packages/ \
&& /opt/venv/bin/pip install --no-cache-dir mysqlclient requests Cheetah3 Pillow \
&& apt-get remove --purge -y gcc \
&& apt-get autoremove --purge -y \
&& /opt/venv/bin/python -c 'import MySQLdb, requests, Cheetah, PIL.Image' \
&& ${WEEWX_HOME}/bin/wee_extension --install /tmp/weewx-weatherlink-live.tar.xz \
&& rm -v /tmp/weewx-weatherlink-live.tar.xz
In any case, it should be possible to take the above steps as an example and update them to install what you need (while removing the stuff you don't need). In this case the resulting image ends up being around 90MB vs around 65MB for the original, so not too bad.
Also, if anyone happens to find this because they are running weewx-weatherlink-live in a Docker image, note that you need the container on the same subnet as the WeatherLink Live in order for UDP broadcasts to work and reports to be generated. This can be accomplished by running the container with --network=host
/hostNetwork: true
.
To confirm, to get my reports generating I had to run pip install Cheetah3 pillow
in the container.
@felddy did you consider releasing a new image with these changes?
Edit: Seems you did. Can anyone confirm whether the issue here is fixed?
I'm sorry. I've totally neglected this issue. I'm catching up on this repo's PRs and issues now. I'll chime in on this after I have a chance to digest it.
I'm sorry. I've totally neglected this issue. I'm catching up on this repo's PRs and issues now. I'll chime in on this after I have a chance to digest it.
@felddy sorry but if that modules are missing and the Docker Hub Image is not working, why you are still releasing it on docker hub?
@felddy was this ever resolved? I can see you made a lot of updates to the repo. But it seems its still not generating the html reports for me with the same error described in this issue. I also opened this discussion before I realised it might be related to this: https://github.com/felddy/weewx-docker/discussions/210
Edit: looks like this PR is still pending approval https://github.com/felddy/weewx-docker/pull/88 - that would do it I guess?
Not only has this not been resolved, but #88 is so out of date, that the file that the patch was applied to no longer exists.
At this point, this project looks like abandonware.
Shame. It almost works. Someone with more time and than me could probably get it back up and running, or maybe get a working Docker working.
Hello @felddy, are you still eager to maintain this project? If not, I want to propose to create a successor fork over at https://github.com/rejuvenate - We aim to provide a place for projects maintained by multiple active community members.
If everyone agrees I will create the fork over the next couple of days. @jonathankoren, @nickbp, all others and @felddy: Who would like to be added as maintainer to the project?
Hello @felddy, are you still eager to maintain this project? If not, I want to propose to create a successor fork over at https://github.com/rejuvenate - We aim to provide a place for projects maintained by multiple active community members.
If everyone agrees I will create the fork over the next couple of days. @jonathankoren, @nickbp, all others and @felddy: Who would like to be added as maintainer to the project?
This project is licensed CC0
. You have the freedom to do anything you'd like with the code. I do not need to be a maintainer on any forks, but I appreciate the offer.
I apologize for not being more attentive to this feature. I have a hard time telling people "No". That said, I don't think it is a good fit for this repo. There is a slippery slope to installing "all the things" and then having to test and support them forever. As you have pointed out, it is easy enough to fork and extend the container.
In the future I'll port over the CONTAINER_PATCHES
functionality that I implemented in my FoundryVTT container. This has proven to be a useful way for users to add a-la-cart functionality and extensions to the container, and a good alternative to creating a new image for those without Docker skills.
At that time I'll remove default extensions like interceptor
or mqtt
and document how to configure them at container startup.
Thank you all for contributing.
Cross posted from #88
I was able to manually add pillow and cheetah to my running container as follows:
With weewx container running docker exec -it -u 0 weewx bash pip install Pillow==9.4.0 pip install CT3
restart weewx container
Ubuntu 22.04
The html files are now properly generated.
It would be nice to have them added to the image but I do not have the knowledge to do that.
Thanks @felddy for your explanation. It's great to see you active and I respect your opinion.
I will release a docker image that is based on the one here, but add the most obvious extensions, including interceptor
, mqtt
, or Pillow
with some useful additions. I already have it configured locally.
🐛 Bug Report
Running latest Raspberry Pi OS and Docker. Utilized template docker-compose.yml with minor tweaks for my environment. weewx runs fine pulling data from my IP based David Vantage Pro 2. Submissions to Wunderground and other providers operating as expected. Web Page generation fails due to missing Cheetah and Images modules. Further, Rsync also appears to be missing from image.
My compose looks as follows:
Variance from template compose file is due to using Portainer v2.0 on Rpi, which is limited to v2.x composer format. I've been unable to utilize the "init: true" as it is unsupported and alternatives do not seem to work either. Unsure if this prevents some internal process your created to install these services, but was unable to locate any references to installing the services post deployment.
Very appreciative for your efforts as one of the few (only?) armhf builds; other main images are 64bit. Here's a broader snapshot of error log: