1

I'm attempting to set up flask to serve as a local webpage to interface with my pi, but for some reason it keeps returning errors when trying to download flask:

sudo pip install flask -v
Downloading/unpacking flask
  Could not fetch URL http://pypi.python.org/simple/flask: <urlopen error [Errno -5] No address associated with hostname>
  Will skip URL http://pypi.python.org/simple/flask when looking for download links for flask
  Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno -5] No address associated with hostname>
  Will skip URL http://pypi.python.org/simple/ when looking for download links for flask
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not fetch URL http://pypi.python.org/simple/flask/: <urlopen error [Errno -5] No address associated with hostname>
  Will skip URL http://pypi.python.org/simple/flask/ when looking for download links for flask
  Could not find any downloads that satisfy the requirement flask
No distributions at all found for flask
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 104, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 245, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 978, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 157, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for flask

Storing complete log in /root/.pip/pip.log

Does anyone know what's going on here, and how to fix it?

Using sudo apt-get install python flask returns:

sudo apt-get install python-flask
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  javascript-common libjs-jquery python-jinja2 python-markupsafe python-openssl python-werkzeug wwwconfig-common
Suggested packages:
  apache2 httpd python-jinja2-doc python-openssl-doc python-openssl-dbg ipython python-genshi python-lxml python-memcache
  libjs-sphinxdoc mysql-client postgresql-client
The following NEW packages will be installed:
  javascript-common libjs-jquery python-flask python-jinja2 python-markupsafe python-openssl python-werkzeug wwwconfig-common
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 149 kB/2,003 kB of archives.
After this operation, 6,414 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-openssl armhf 0.13-2+rpi1
  404  Not Found
Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/p/pyopenssl/python-openssl_0.13-2+rpi1_armhf.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Thanks to Joan for the answer -

Running sudo apt-get update seemed to fix any issues with installing flask.

4
  • Does the internet actually work on the Pi? Does ping 8.8.8.8 do anything? It could also be a problem with one of the commands being called on to download what is required - wget, curl etc
    – Wilf
    Jun 14, 2014 at 18:44
  • Yep, there is an internet connection - pinging websites works fine.
    – AndyB
    Jun 15, 2014 at 8:33
  • Looks like it was a problem with not having ran sudo apt-get update beforehand. All is good now.
    – AndyB
    Jun 15, 2014 at 8:56
  • then mark @joan 's answer as the answer, or add that as the answer then :D
    – Wilf
    Jun 15, 2014 at 9:01

1 Answer 1

0

Is there any reason not to use the one in the repository? The repository version will be compatible with the other Raspbian modules.

apt-cache search flask
checkpolicy - SELinux policy compiler
libselinux1 - SELinux runtime shared libraries
libselinux1-dev - SELinux development headers
libsemanage1 - SELinux policy management library
libsemanage1-dev - Header files and libraries for SELinux policy manipulation
libsepol1 - SELinux library for manipulating binary security policies
policycoreutils - SELinux core policy utilities
python-flask - micro web framework based on Werkzeug, Jinja2 and good intentions
python-flaskext.wtf - Simple integration of Flask and WTForms
python-selinux - Python bindings to SELinux shared libraries
python-semanage - Python bindings for SELinux policy management
ruby-selinux - Ruby bindings to SELinux shared libraries
ruby-semanage - Ruby bindings to for SELinux policy management

sudo apt-get update

sudo apt-get install python-flask
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  javascript-common libjs-jquery python-jinja2 python-markupsafe
  python-openssl python-werkzeug wwwconfig-common
Suggested packages:
  python-jinja2-doc python-openssl-doc python-openssl-dbg ipython
  python-genshi python-lxml python-memcache libjs-sphinxdoc postgresql-client
The following NEW packages will be installed:
  javascript-common libjs-jquery python-flask python-jinja2 python-markupsafe
  python-openssl python-werkzeug wwwconfig-common
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,006 kB of archives.
After this operation, 6,422 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main wwwconfig-common all 0.2.2 [22.8 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libjs-jquery all 1.7.2+dfsg-1 [80.1 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main javascript-common all 7 [3,810 B]
Get:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-werkzeug all 0.8.3+dfsg-1 [1,486 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-flask all 0.8-1 [79.3 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-openssl armhf 0.13-2+rpi1+deb7u1 [152 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-markupsafe armhf 0.15-1 [14.5 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ wheezy/main python-jinja2 armhf 2.6-1 [167 kB]
Fetched 2,006 kB in 34s (58.5 kB/s)                                            
Selecting previously unselected package wwwconfig-common.
(Reading database ... 76221 files and directories currently installed.)
Unpacking wwwconfig-common (from .../wwwconfig-common_0.2.2_all.deb) ...
Selecting previously unselected package javascript-common.
Unpacking javascript-common (from .../javascript-common_7_all.deb) ...
Selecting previously unselected package libjs-jquery.
Unpacking libjs-jquery (from .../libjs-jquery_1.7.2+dfsg-1_all.deb) ...
Selecting previously unselected package python-werkzeug.
Unpacking python-werkzeug (from .../python-werkzeug_0.8.3+dfsg-1_all.deb) ...
Selecting previously unselected package python-markupsafe.
Unpacking python-markupsafe (from .../python-markupsafe_0.15-1_armhf.deb) ...
Selecting previously unselected package python-jinja2.
Unpacking python-jinja2 (from .../python-jinja2_2.6-1_armhf.deb) ...
Selecting previously unselected package python-flask.
Unpacking python-flask (from .../python-flask_0.8-1_all.deb) ...
Selecting previously unselected package python-openssl.
Unpacking python-openssl (from .../python-openssl_0.13-2+rpi1+deb7u1_armhf.deb) ...
Setting up wwwconfig-common (0.2.2) ...
Setting up javascript-common (7) ...
Setting up libjs-jquery (1.7.2+dfsg-1) ...
Setting up python-werkzeug (0.8.3+dfsg-1) ...
Setting up python-markupsafe (0.15-1) ...
Setting up python-jinja2 (2.6-1) ...
Setting up python-flask (0.8-1) ...
Setting up python-openssl (0.13-2+rpi1+deb7u1) ...
Processing triggers for python-support ...
hard /ram $ python
Python 2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>> 
7
  • sudo apt-get install python-flask doesn't seem to actually install flask. I get an import error when trying to import it in a simple helloworld script.
    – AndyB
    Jun 14, 2014 at 17:07
  • I just installed using apt-get install and import flask works within Python. Perhaps the failed pip has mucked up your system.
    – joan
    Jun 14, 2014 at 17:22
  • gah, should I just reinstall raspbian?
    – AndyB
    Jun 14, 2014 at 17:28
  • I'd try a sudo apt-get purge python-flask and then a sudo apt-get install python flask. Sometimes that sort of invocation tidies up a mess. Remember I'm only guessing that pip mucked up your system.
    – joan
    Jun 14, 2014 at 19:09
  • 1
    Yesterday I installed on a Debian Pi. I have just done exactly the same on a Raspbian Pi. It installs OK and imports OK into Python. Have you done a sudo apt-get update? I don't see why that would be needed, but who knows.
    – joan
    Jun 15, 2014 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.