Celery: Python 3.7 syntax error: async is a reserved keyword

Created on 26 Jun 2018  ·  17Comments  ·  Source: celery/celery

Checklist

Happens on master and previously released versions as well.

Steps to reproduce

See https://github.com/celery/celery/blob/b2668607c909c61becd151905b4525190c19ff4a/celery/backends/redis.py#L22 and https://github.com/celery/celery/blob/b2668607c909c61becd151905b4525190c19ff4a/celery/backends/rpc.py#L20 and https://github.com/celery/celery/blob/master/celery/backends/async.py

Expected behavior

Module should not be named async.

Actual behavior

Module is named async.

More info

I fail to run 3.7 test easily, but this leads to:

  File "celery/backends/redis.py", line 22
    from . import async, base
                      ^
SyntaxError: invalid syntax

Most helpful comment

If anyone needs the changes right now then you can do pip install --upgrade https://github.com/celery/celery/tarball/master to get the fixes temporarily directly from development branch. Maybe it saves people finding this issue from Google some effort.

All 17 comments

Nice catch. This is already handled in #4500. The module will be renamed to asynchronous soon. @auvipy should we close as duplicate?

Sure. Sorry I haven't noticed that one.

i will take care of this today

Since #4500 is closed, I'm reopening this one.

yeah ok I have already started working

work is merged in master

Can we anticipate a quick release or not? Just want to make sure whether we need to patch the Fedora package or wait.

we have a plan to release a minor on before the end of this month

Thanks.

If anyone needs the changes right now then you can do pip install --upgrade https://github.com/celery/celery/tarball/master to get the fixes temporarily directly from development branch. Maybe it saves people finding this issue from Google some effort.

I'm still getting this error when trying to run celery 4.2.1, will this fix be available in an upcoming release?

yes, try master branch if you are in hurry for python 3.7

Yup, would be nice to have this fix released soon, since Python 3.7 is the default you get on python.org / homebrew etc.

For anyone looking for a way to install Celery from master using Pipenv:

pipenv install -e git+https://github.com/celery/celery.git@master#egg=celery

OK, correction – the above doesn't work in pipenv (at least not as part of a Docker build with a step RUN pipenv install --system --dev). I'm getting ImportErrors for celery not being there (I think it's because it gets placed in some local src folder that doesn't remain there for some reason).

I've also tried the following:

pipenv install https://github.com/celery/celery/tarball/master

in which case celery does get installed and can get imported, but it seems that this command doesn't install the dependencies… (might be related to this issue)

web_1     |   File "/usr/local/lib/python3.7/site-packages/celery/five.py", line 7, in <module>
web_1     |     import vine.five
web_1     | ModuleNotFoundError: No module named 'vine'

So, Celery is now broken if you want to use latest stable Python, Pipenv + Docker 😢.

Regarding installation of Celery from GitHub as editable which seems to be a Pipenv issue, I've opened a bug there.

better stick with python 3.6 for celery 4.2, there are some other small issues regarding python 3.7 in the dependencies.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Xuexiang825 picture Xuexiang825  ·  3Comments

budlight picture budlight  ·  3Comments

steinliber picture steinliber  ·  3Comments

jheld picture jheld  ·  3Comments

maxim25 picture maxim25  ·  3Comments