Syntax error installing gunicorn

Question:

I am following this Heroku tutorial: https://devcenter.heroku.com/articles/getting-started-with-python-o and when I am trying to install gunicorn in a virtualenv I am getting this error:

(venv)jabuntu14@ubuntu:~/Desktop/helloflask$ pip install gunicorn
Downloading/unpacking gunicorn
Downloading gunicorn-19.1.1-py2.py3-none-any.whl (104kB): 104kB downloaded
Installing collected packages: gunicorn
Compiling /home/jabuntu14/Desktop/helloflask/venv/build/gunicorn/gunicorn/workers    /_gaiohttp.py ...
File "/home/jabuntu14/Desktop/helloflask/venv/build/gunicorn/gunicorn/workers    /_gaiohttp.py", line 64
    yield from self.wsgi.close()
         ^

SyntaxError: invalid syntax
Successfully installed gunicorn
Cleaning up...

However, when I run $foreman start it appears to work properly.

How important is this error? Any idea how to solve it?

Asked By: Javi

||

Answers:

The error can be ignored, your gunicorn package installed successfully.

The error is thrown by a bit of code that’d only work on Python 3.3 or newer, but isn’t used by older Python versions that Gunicorn supports.

See https://github.com/benoitc/gunicorn/issues/788:

The error is a syntax error happening during install. It is harmless.

During installation the setup.py script tries to collect all files to be installed, and compiles them to .pyc bytecache files. One file that is used only on Python 3.3 or up is included in this and the compilation for that one file fails.

The file in question adds support for the aiohttp http client/server package, which only works on Python 3.3 and up anyway. As such you can ignore this error entirely.

Answered By: Martijn Pieters
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.