Help adafruit_dht

hi
I’m trying to install adafruit_dht on Python 3 but I always get this error.
I am going crazy …

WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/certifi/

  • which instructions did you follow to install adafruit_dht on the system ?
  • what OS do you use ?
  • which version of the OS do you use ?
  • is the error message as you posted it complete or is something missing at the end ?
  • what is the python version that you use ( 3.??; run python3 --version ) ?

sudo pip3 install Adafruit_DHT
raspberry py 2 whit openhab on board
openhab 4.0.4 and python 3.10.6
this is complete error

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Looking in indexes: Simple index, piwheels - Simple index
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
Could not fetch URL https://pypi.org/simple/adafruit-dht/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org’, port=443): Max retries exceeded with url: /simple/adafruit-dht/ (Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)) - skipping
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)’: /simple/adafruit-dht/
Could not fetch URL https://www.piwheels.org/simple/adafruit-dht/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘www.piwheels.org’, port=443): Max retries exceeded with url: /simple/adafruit-dht/ (Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)) - skipping
ERROR: Could not find a version that satisfies the requirement Adafruit_DHT (from versions: none)
ERROR: No matching distribution found for Adafruit_DHT
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘pypi.org’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)) - skipping
Could not fetch URL https://www.piwheels.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host=‘www.piwheels.org’, port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)) - skipping
WARNING: There was an error checking the latest version of pip.

The OS version is Bullseye ? To check the version you can run

cat /etc/os-release

Is the openssl package installed ? Which version of the openssl package is installed ?
Googling for the error message shows up some threads telling that openssl 1.1.1 is required.
Is the system up to date with regard to installed patches ?

updated system
ssl version 1.1.1w
os version bullseye

I don’t see that python3.10.6 is one of the packages being distributed by the Raspberry Pi Debian ( bullseye ) package maintainers. Where does it come from ?
As far as I understand the problem either that python version is incompatible with the installed openssl version which would mean python has to be rebuild with that openssl version or module python3-openssl is missing.

I updated python or updated the openssl module, still same error.
You advise me to delete python3 or format and start from the beginning?!

I do not want to break your system. At this moment I do not exactly understand what happened - why the current combination of python and openssl is installed on your OS.
In case I would give the wrong advise under these circumstances may break the system.
What you could try would be to install miniconda. This is a python installation that is independent of the OS defaults and will be installed into a users directory. That would be an install of python from ‘scratch’ without the risk of breaking the existing system but require additional space. I don’t have experience doing that on a pi 2.
But as this is installed into a users home directory ( e.g. openhabian ) depending on what you would like to do ( e.g. run it from within a rule of the openhab user ) you need to take care with permissions and paths which means do not install it into the home directory of user root. Depends on permissions that are required for adafruit_dht at the end.

On the other hand does your current python installation with regard to pip work at all ? Based on the error message my understanding is that you always get the posted error message independent of the adafruit_dht module. If that is the case the python installation is broken anyway. In that case removing the existing python installation would free up resources.
Do a backup of your system before doing any of the suggestions. As long as you know what you do and you do dry runs of the command before executing them you should be able to judge the consequences.

1 Like

Resolved.
Formatted everything and started from zero.
Now on python, dht22 it reads the results to me.
I would like to understand how to get them in openhab3

1 Like

You have different possibilities:

  • process them in a linux shell command by running your python script and hand over the result to send it via MQTT to OH
  • process them in a linux shell command by running your python script and write it to OH by using REST API command
  • wrap everything into a shell script that returns the read value to STDOUT; call this script by running executecommandline; the returned value can be stored into an item/updated to an item in a rule then