[Adafruit] Can't install DHT Library

OctoPi 0.14
OctoPrint Version 1.3.8
Raspberry Pi 3

Fresh installation. Tried to install Adafruit DHT library for enclosure plugin. Followed this:

cd ~
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo apt-get update
sudo apt-get install build-essential python-dev python-openssl
sudo python setup.py install

Last step causes this:

pi@octopi:~ $ cd Adafruit_Python_DHT
pi@octopi:~/Adafruit_Python_DHT $ sudo python setup.py install
Extracting in /tmp/tmplLz9Sv
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    use_setuptools()
  File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 145, in use_setuptools
    return _do_download(version, download_base, to_dir, download_delay)
  File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 120, in _do_download
    _build_egg(egg, archive, to_dir)
  File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 62, in _build_egg
    with archive_context(archive_filename):
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 100, in archive_context
    with ContextualZipFile(filename) as archive:
  File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 88, in __new__
    return zipfile.ZipFile(*args, **kwargs)
  File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

Any ideas? Can’t figure out what’s going wrong. Thanks in advance.

Try adding:

sudo apt-get install python-pip

before the:

sudo python setup.py install

Please report the problem in the Adafruit forums. I had a very similar problem with their DC Motor Hat. Adafruit needs to go through all of their software installations and make sure they work on the more recent versions of Raspbian (OctoPi).

3 Likes

Thank you very much, that solved my problem.

omg thank you so much