I need to use a DHT-11 for a school project and I am getting a weird error trying to install the packages for it.
Following the instructions I used sudo pip3 install Adafruit_DHT
and that resulted in this output:
sudo pip3 install Adafruit_DHT
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit_DHT
Using cached Adafruit_DHT-1.4.0.tar.gz (15 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: Adafruit_DHT
Building wheel for Adafruit_DHT (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
Could not detect if running on the Raspberry Pi or Beaglebone Black. If this failure is unexpected, you can run again with --force-pi or --force-bbb parameter to force using the Raspberry Pi or Beaglebone Black respectively.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for Adafruit_DHT
Running setup.py clean for Adafruit_DHT
Failed to build Adafruit_DHT
Installing collected packages: Adafruit_DHT
Running setup.py install for Adafruit_DHT ... error
error: subprocess-exited-with-error
× Running setup.py install for Adafruit_DHT did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
Could not detect if running on the Raspberry Pi or Beaglebone Black. If this failure is unexpected, you can run again with --force-pi or --force-bbb parameter to force using the Raspberry Pi or Beaglebone Black respectively.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> Adafruit_DHT
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I also tried running sudo pip3 install Adafruit_DHT --install-option="--force-pi"
which output:
WARNING: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting Adafruit_DHT
Using cached Adafruit_DHT-1.4.0.tar.gz (15 kB)
Preparing metadata (setup.py) ... done
Skipping wheel build for Adafruit_DHT, due to binaries being disabled for it.
Installing collected packages: Adafruit_DHT
Running setup.py install for Adafruit_DHT ... done
Successfully installed Adafruit_DHT
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
However, when I run my python code I get this
import Adafruit_DHT
ModuleNotFoundError: No module named 'Adafruit_DHT'
I've updated pip and the setup tools and I'm pretty new to all of this. This assignment is due soon and I just want to get this DHT working. Thanks in advance.
I had the same problem when I tried to install the Adafruit_DHT on my py.
When I reinstalled wheel with:
sudo python3 -m pip install --upgrade pip setuptools wheel
and then:
sudo pip3 install Adafruit_DHT
it worked for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.