I can not install RaspBerry 3 and Raspbian Jessie Lite
DinoFontana opened this issue · 10 comments
-
Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): Raspberry Raspbian Jessie lite -
Python version (run
python -version
orpython3 -version
): 2.7 -
Error message you are receiving, including any Python exception traces: ```
File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
raise BadZipfile, "File is not a zip file"
- List the steps to reproduce the problem below (if possible attach code or commands
to run): ```
root@raspberrypi:~/Adafruit_Python_DHT sudo python setup.py install
Extracting in /tmp/tmp1VV7R9
Traceback (most recent call last):
File "setup.py", line 4, in <module>
use_setuptools()
File "/root/Adafruit_Python_DHT/ez_setup.py", line 140, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/root/Adafruit_Python_DHT/ez_setup.py", line 120, in _do_download
_build_egg(egg, archive, to_dir)
File "/root/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 "/root/Adafruit_Python_DHT/ez_setup.py", line 100, in archive_context
with ContextualZipFile(filename) as archive:
File "/root/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
root@raspberrypi:~/Adafruit_Python_DHT
Can you try to redownload the files and try again? Also have you made sure your python environment is up to date? And lastly can you describe to me how you downloaded the file? This error is possibly due to a corrupt file that was downloaded. Haven't had this issue myself working in Python 2.7 or 3 on a Pi3 which is why I ask.
I'll show you all the steps I do:
root@raspberrypi:/# cd /home/pi
root@raspberrypi:/home/pi# git clone https://github.com/adafruit/Adafruit_Python_DHT.git
Cloning into 'Adafruit_Python_DHT'...
remote: Counting objects: 249, done.
remote: Total 249 (delta 0), reused 0 (delta 0), pack-reused 249
Ricezione degli oggetti: 100% (249/249), 77.00 KiB | 0 bytes/s, done.
Risoluzione dei delta: 100% (142/142), done.
Checking connectivity... fatto.
root@raspberrypi:/home/pi# cd Adafruit_Python_DHT/
root@raspberrypi:/home/pi/Adafruit_Python_DHT# sudo apt-get install build-essential python-dev
Lettura elenco dei pacchetti... Fatto
Generazione albero delle dipendenze
Lettura informazioni sullo stato... Fatto
build-essential è già alla versione più recente.
python-dev è già alla versione più recente.
0 aggiornati, 0 installati, 0 da rimuovere e 3 non aggiornati.
root@raspberrypi:/home/pi/Adafruit_Python_DHT# python setup.py build
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-4.0.1.zip
Extracting in /tmp/tmpjAJfvJ
Traceback (most recent call last):
File "setup.py", line 4, in <module>
use_setuptools()
File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 140, 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
root@raspberrypi:/home/pi/Adafruit_Python_DHT# sudo python setup.py install
Extracting in /tmp/tmpWG7D4E
Traceback (most recent call last):
File "setup.py", line 4, in <module>
use_setuptools()
File "/home/pi/Adafruit_Python_DHT/ez_setup.py", line 140, 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
root@raspberrypi:/home/pi/Adafruit_Python_DHT
Thanks
This is what I see when I do the install.
pi@raspberrypi:~ $ git clone https://github.com/adafruit/Adafruit_Python_DHT.gitCloning into 'Adafruit_Python_DHT'...
remote: Counting objects: 249, done.
remote: Total 249 (delta 0), reused 0 (delta 0), pack-reused 249
Receiving objects: 100% (249/249), 77.00 KiB | 0 bytes/s, done.
Resolving deltas: 100% (142/142), done.
Followed by:
pi@raspberrypi:~/Adafruit_Python_DHT $ sudo apt-get install build-essential python-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.3).
python-dev is already the newest version (2.7.13-2).
python-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
Is there a reason you did this step instead of simply just running python setup.py install?
root@raspberrypi:/home/pi/Adafruit_Python_DHT# python setup.py build
I ask because you get the same error when trying to do that and it again seems like there's a corrupted file somewhere. Maybe it's an issue with the Lite version of the OS install as you shouldn't need to download a copy of setuptools if everything is setup properly with your python installation.
Maybe try
python -m pip install --upgrade pip setuptools wheel
Before running python setup.py install.
I had the same problem today.
As a workaround, I just download setuptools-4.0.1.zip
manually in the folder, and relaunch the install.
I don't know why the downloaded zip file from the installer is not good, perhaps my downloader was not configure to follow redirections
@sim51 Glad that worked for you. The thing that's odd to me though is you shouldn't need to install from that zip file if you already have setuptools in your Python environment which I personally didn't think was missing from my last Raspbian Lite install's Python env. but maybe I added it after the fact.
Hello,
I also solved by manually downloading the file setuptools-4.0.1.zip
thanks
Yep it's weird ....
As the documentation mentioned it, I have installed python like this :
sudo apt-get update
sudo apt-get install build-essential python-dev
And if I do this on the pyhton console, I don't see any trace of setuptool :
> import sys
> sys.modules
{'copy_reg': <module 'copy_reg' from '/usr/lib/python2.7/copy_reg.pyc'>, 'sre_compile': <module 'sre_compile' from '/usr/lib/python2.7/sre_compile.pyc'>, '_sre': <module '_sre' (built-in)>, 'encodings': <module 'encodings' from '/usr/lib/python2.7/encodings/__init__.pyc'>, 'site': <module 'site' from '/usr/lib/python2.7/site.pyc'>, '__builtin__': <module '__builtin__' (built-in)>, 'sysconfig': <module 'sysconfig' from '/usr/lib/python2.7/sysconfig.pyc'>, '__main__': <module '__main__' (built-in)>, 'encodings.encodings': None, 'abc': <module 'abc' from '/usr/lib/python2.7/abc.pyc'>, 'posixpath': <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>, '_weakrefset': <module '_weakrefset' from '/usr/lib/python2.7/_weakrefset.pyc'>, 'errno': <module 'errno' (built-in)>, 'encodings.codecs': None, 'sre_constants': <module 'sre_constants' from '/usr/lib/python2.7/sre_constants.pyc'>, 're': <module 're' from '/usr/lib/python2.7/re.pyc'>, '_abcoll': <module '_abcoll' from '/usr/lib/python2.7/_abcoll.pyc'>, 'types': <module 'types' from '/usr/lib/python2.7/types.pyc'>, '_codecs': <module '_codecs' (built-in)>, 'encodings.__builtin__': None, '_warnings': <module '_warnings' (built-in)>, 'genericpath': <module 'genericpath' from '/usr/lib/python2.7/genericpath.pyc'>, 'stat': <module 'stat' from '/usr/lib/python2.7/stat.pyc'>, 'zipimport': <module 'zipimport' (built-in)>, '_sysconfigdata': <module '_sysconfigdata' from '/usr/lib/python2.7/_sysconfigdata.pyc'>, 'warnings': <module 'warnings' from '/usr/lib/python2.7/warnings.pyc'>, 'UserDict': <module 'UserDict' from '/usr/lib/python2.7/UserDict.pyc'>, 'encodings.utf_8': <module 'encodings.utf_8' from '/usr/lib/python2.7/encodings/utf_8.pyc'>, 'sys': <module 'sys' (built-in)>, 'codecs': <module 'codecs' from '/usr/lib/python2.7/codecs.pyc'>, 'readline': <module 'readline' from '/usr/lib/python2.7/lib-dynload/readline.arm-linux-gnueabihf.so'>, '_sysconfigdata_nd': <module '_sysconfigdata_nd' from '/usr/lib/python2.7/plat-arm-linux-gnueabihf/_sysconfigdata_nd.pyc'>, 'os.path': <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>, '_locale': <module '_locale' (built-in)>, 'sitecustomize': <module 'sitecustomize' from '/usr/lib/python2.7/sitecustomize.pyc'>, 'signal': <module 'signal' (built-in)>, 'traceback': <module 'traceback' from '/usr/lib/python2.7/traceback.pyc'>, 'linecache': <module 'linecache' from '/usr/lib/python2.7/linecache.pyc'>, 'posix': <module 'posix' (built-in)>, 'encodings.aliases': <module 'encodings.aliases' from '/usr/lib/python2.7/encodings/aliases.pyc'>, 'exceptions': <module 'exceptions' (built-in)>, 'sre_parse': <module 'sre_parse' from '/usr/lib/python2.7/sre_parse.pyc'>, 'os': <module 'os' from '/usr/lib/python2.7/os.pyc'>, '_weakref': <module '_weakref' (built-in)>}
My raspberry is a version 3 with the 2018-04-18-raspbian-stretch-lite
image.
Hope it can helps.
The file is now in the repo, setuptools-4.0.1.zip
But it still does not work for me
Comment from #92 @bargacha solved my problem...
rm setuptools-4.0.1.zip
wget https://files.pythonhosted.org/packages/cb/e0/b5ecf534e14304e62c781614d683d0daa571efe92678901559ea84c1559e/setuptools-4.0.1.zip
python setup.py build
sudo python setup.py install
More info here : https://pypi.org/project/setuptools/
Choose "release history", and look for 4.0.1 (Old version released in 2015)
I can confirm the install crashes on the python setu.py install.
The Ansible playbook I wrote for the install last spring has worked good until about 6 weeks ago. Now I have the RPi's in, it is a bit annoying the time I invested in creating the playbook isn't payed back by a smooth install of all the RPi's at the same time. Oh, well, at least I learned the basics on Ansible :-)