Docker "ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 3.0.2."
rbrouwer opened this issue ยท 10 comments
Describe the bug:
Starting the current docker image will not work.
The docker container will continuously restart.
Expected behavior:
I expect the docker container to install everything needed and start after that.
Logs:
dzga | Traceback (most recent call last):
dzga | File "/__main__.py", line 4, in <module>
dzga | from server import *
dzga | File "/server.py", line 6, in <module>
dzga | from helpers import FILE_DIR
dzga | File "/helpers.py", line 14, in <module>
dzga | import requests
dzga | File "/usr/local/lib/pyenv/versions/3.7.3/lib/python3.7/site-packages/requests/__init__.py", line 43, in <module>
dzga | import urllib3
dzga | File "/usr/local/lib/pyenv/versions/3.7.3/lib/python3.7/site-packages/urllib3/__init__.py", line 39, in <module>
dzga | "urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
dzga | ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 3.0.2. See: https://github.com/urllib3/urllib3/issues/2168
Desktop (please complete the following information):
- Domoticz version 2023.1 (build 15112)
- Dzga version V.1.23.2
- Python Version 3.7
Smartphone (please complete the following information):
- Device: Desktop
I had everything working correctly, when updating the docker it gives me the same error.
I don't use docker. I will need some help fixing this issue.
@DewGew, it is not limited to docker, but it will most likely show up there cause all dependencies are installed on start.
I believe one of your requirements is "urllib3>=1.25.7", which released version 2.0 last week. This is likely what triggered this error to happen.
A quick fix would likely be limiting to urllib3 < 2 and monitor this issue as well.
Also the docker images are based on alpine-python, which sadly is not really well maintained. It is still based on Alpine 3.11, which is old and already EoL since 2021-11-01. That's possibly why there is no OpenSSL 1.1.1+ support in that base image.
For those really wanting their DZGA docker to work now, here is a workaround:
Download the requirements file and replace the line:
urllib3>=1.25.7
with the following line:
urllib3>=1.25.7,<2
Then adjust your docker to mount that file in /requirements.txt by adjusting the container. For docker compose, just adjust the file to contain:
volumes:
- <path to adjusted requirements.txt file>:/requirements.txt:ro
The docker should work again. Of course this should be undone when this issue is resolved.
I checked what you say and it didn't work for me, but after changing the line from urllib3>=1.25.7 to urllib3==1.25.7 in the requirements file, I was able to make it work!
@DewGew Can you modify the docker requirements file to solve the problem?
For those really wanting their DZGA docker to work now, here is a workaround:
Download the requirements file and replace the line:
urllib3>=1.25.7
with the following line:urllib3>=1.25.7,<2
Then adjust your docker to mount that file in /requirements.txt by adjusting the container. For docker compose, just adjust the file to contain:
volumes: - <path to adjusted requirements.txt file>:/requirements.txt:ro
The docker should work again. Of course this should be undone when this issue is resolved.
Try latsest beta, test if its working..
I believe your commit/fix will not work:
You've got:
urllib3>=1.26,<3
, which would allow urllib3 version 2 to be used/installed, which will not work within your docker.
It should be
urllib3>=1.26,<2
The new version still doesn't work. As you can see in the image, it continues downloading the version "urllib3-2.0.2-py3-none-any.whl".
Modifying the requirements file as @rbrouwer comments with the option urllib3>=1.26,<2 will work correctly with the new version DZGA v1.23.6.
The new version still doesn't work. As you can see in the image, it continues downloading the version "urllib3-2.0.2-py3-none-any.whl".
Modifying the requirements file as @rbrouwer comments with the option urllib3>=1.26,<2 will work correctly with the new version DZGA v1.23.6.
Changed to urllib>=1.26,<2
pip-requrement.txt