Flask install problems

A forum for general discussion of the Python programming language.

Flask install problems

Postby PeterA » Mon Dec 23, 2013 8:54 pm

Hello there,

I hope that someone can help me, I am rather new to python and struggling with Flask installation. I've bee trying to figure this out for couple of days but internet searching does not show any sollutions.
My environment : LInux Centos 5.10, Python 2.4.3 (is it possibly because this is too old version of python?)
Here is the error message:
Code: Select all
$ pip install Flask
Downloading/unpacking Flask
  Running setup.py egg_info for package Flask
    Traceback (most recent call last):
      File "<string>", line 14, in ?
      File "/home/user1/build/Flask/setup.py", line 41
        from __future__ import print_function
    SyntaxError: future feature print_function is not defined
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in ?

  File "/home/user1/build/Flask/setup.py", line 41

    from __future__ import print_function

SyntaxError: future feature print_function is not defined

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /home/user/.pip/pip.log

Thank you

PeterA
Last edited by Yoriz on Mon Dec 23, 2013 10:28 pm, edited 1 time in total.
Reason: First post lock, Added code tags
PeterA
 
Posts: 2
Joined: Mon Dec 23, 2013 8:39 pm

Re: Flask install problems

Postby Yoriz » Mon Dec 23, 2013 10:30 pm

Hi, welcome to the forum.
Please read the 'new users, read this' link in my signature.

The print_function became optional from version 2.6.0a2 so you would need to update your python to at least that.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 759
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: Flask install problems

Postby PeterA » Tue Dec 24, 2013 7:07 pm

Thank you Yoriz for a quick repy.
I installed python2.7.6 and it appears to be working fine, but when I try to install setuptools with ez_setup I am getting this error below. It looks like I can't pull setuptools from the source server because of the certificate issue. It failed initially, and I tried next the "--no-check-certificate" option with no luck. I think it's time to switch to Centos6.4 and use the default python version.

Code: Select all
$ sudo wget --no-check-certificate https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python2.7
--2013-12-24 13:46:05--  https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
Resolving bitbucket.org... 131.103.20.168, 131.103.20.167
Connecting to bitbucket.org|131.103.20.168|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11358 (11K) [text/plain]
Saving to: `STDOUT'

100%[=====================================================================================>] 11,358      --.-K/s   in 0s

2013-12-24 13:46:05 (265 MB/s) - `-' saved [11358/11358]

Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.1.tar.gz
/usr/src/Python-2.7.6/setuptools-2.0.1.tar.gz: Permission denied
Traceback (most recent call last):
  File "<stdin>", line 361, in <module>
  File "<stdin>", line 357, in main
  File "<stdin>", line 282, in download_setuptools
  File "<stdin>", line 207, in download_file_wget
  File "<stdin>", line 152, in _clean_check
  File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['wget', 'https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.1.tar.gz', '--quiet', '--output-document', '/usr/src/Python-2.7.6/setuptools-2.0.1.tar.gz']' returned non-zero exit status 1
PeterA
 
Posts: 2
Joined: Mon Dec 23, 2013 8:39 pm

Re: Flask install problems

Postby John_S » Wed Jan 08, 2014 8:24 am

Hello there,

I stumbled upon your thread by chance as I was having the same problem and after some research I found a way to solve it. The error comes from "def download_file_wget(url, target):" on line 205 as that function downloads setupfiles with wget (on CentOS) over HTTPS but without the flag --no-check-certificate which seems to cause an error (--no-check-certificate that you put in command line does not count as it only applies to the downloading of ez_setup.py) so the way I found that solved it for me was adding manually --no-check-certificate to def download_file_wget in the ez_setup.py file, but that requires you to manually edit the file. My function looked like this after my edit:
Code: Select all
def download_file_wget(url, target):
    cmd = ['wget', url, '--quiet', '--no-check-certificate', '--output-document', target]
    _clean_check(cmd, target)


Hope it helps those who stumbled upon the same error.
Last edited by Mekire on Wed Jan 08, 2014 10:29 am, edited 1 time in total.
Reason: First post lock.
John_S
 
Posts: 1
Joined: Wed Jan 08, 2014 8:15 am


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests