Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'float' object has no attribute 'items' #5175

Closed
noufalvlpr opened this issue Nov 15, 2018 · 17 comments
Closed

AttributeError: 'float' object has no attribute 'items' #5175

noufalvlpr opened this issue Nov 15, 2018 · 17 comments

Comments

@noufalvlpr
Copy link

on running celery -A proj worker throws this error

[2018-11-15 12:02:53,607: CRITICAL/MainProcess] Unrecoverable error: AttributeError("'float' object has no attribute 'items'",)
Traceback (most recent call last):
File "/user/lib/python3.6/site-packages/celery/worker/worker.py", line 205, in start
self.blueprint.start(self)
File "/user/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/user/lib/python3.6/site-packages/celery/bootsteps.py", line 369, in start
return self.obj.start()
File "/user/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 317, in start
blueprint.start(self)
File "/user/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/user/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 593, in start
c.loop(*c.loop_args())
File "/user/lib/python3.6/site-packages/celery/worker/loops.py", line 91, in asynloop
next(loop)
File "/user/lib/python3.6/site-packages/kombu/asynchronous/hub.py", line 354, in create_loop
cb(*cbargs)
File "/user/lib/python3.6/site-packages/kombu/transport/redis.py", line 1040, in on_readable
self.cycle.on_readable(fileno)
File "/user/lib/python3.6/site-packages/kombu/transport/redis.py", line 337, in on_readable
chan.handlerstype
File "/user/lib/python3.6/site-packages/kombu/transport/redis.py", line 724, in _brpop_read
self.connection._deliver(loads(bytes_to_str(item)), dest)
File "/user/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 983, in _deliver
callback(message)
File "/user/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 632, in _callback
self.qos.append(message, message.delivery_tag)
File "/user/lib/python3.6/site-packages/kombu/transport/redis.py", line 149, in append
pipe.zadd(self.unacked_index_key, time(), delivery_tag)
File "/user/lib/python3.6/site-packages/redis/client.py", line 2263, in zadd
for pair in iteritems(mapping):
File "/user/lib/python3.6/site-packages/redis/_compat.py", line 123, in iteritems
return iter(x.items())
AttributeError: 'float' object has no attribute 'items'

Using Python 3.6.6, redis 3.0.0.post1

@sethsec
Copy link

sethsec commented Nov 15, 2018

I'm getting a very similar error this morning:

[2018-11-15 09:55:33,342: CRITICAL/MainProcess] Unrecoverable error: AttributeError("'float' object has no attribute 'iteritems'",)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/worker.py", line 205, in start
    self.blueprint.start(self)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 369, in start
    return self.obj.start()
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer/consumer.py", line 317, in start
    blueprint.start(self)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer/consumer.py", line 593, in start
    c.loop(*c.loop_args())
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/loops.py", line 91, in asynloop
    next(loop)
  File "/usr/local/lib/python2.7/dist-packages/kombu/asynchronous/hub.py", line 354, in create_loop
    cb(*cbargs)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 1040, in on_readable
    self.cycle.on_readable(fileno)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 337, in on_readable
    chan.handlers[type]()
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 724, in _brpop_read
    self.connection._deliver(loads(bytes_to_str(item)), dest)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/base.py", line 983, in _deliver
    callback(message)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/virtual/base.py", line 632, in _callback
    self.qos.append(message, message.delivery_tag)
  File "/usr/local/lib/python2.7/dist-packages/kombu/transport/redis.py", line 149, in append
    pipe.zadd(self.unacked_index_key, time(), delivery_tag) \
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 2263, in zadd
    for pair in iteritems(mapping):
  File "/usr/local/lib/python2.7/dist-packages/redis/_compat.py", line 94, in iteritems
    return x.iteritems()
AttributeError: 'float' object has no attribute 'iteritems'

Python 2.7, Redis 3.0.0.post1

@sethsec
Copy link

sethsec commented Nov 15, 2018

Not a celery issue - Seems to be an issue with Redis 3.0.0.post1 installed via pip.

Solution: Roll back redis with pip: pip install redis==2.10.6

everything working again for me.

@dannyshaw
Copy link

Dependency pinning is a celery issue. Looks to be fixed here though
#5176

@guyisra
Copy link

guyisra commented Nov 16, 2018

Can we quick release 4.2.2 to solve this please?

@clokep
Copy link
Contributor

clokep commented Nov 16, 2018

You can pin the dependency outside of Celery until this is fixed.

waynesun09 added a commit to waynesun09/metadash that referenced this issue Nov 17, 2018
Latest redis 3.0.1 version is not compatiable with celery,
lock the version to 2.10.6 for now.

Celery have updated with:
celery/celery#5175

not release yet.

Signed-off-by: Wayne Sun <gsun@redhat.com>
code-haven added a commit to code-haven/redlock that referenced this issue Nov 19, 2018
There was a bug in the latest version of redis package that caused our celery containers to crash. After inspecting the dependencies of all packages, we figured out that redlock hadn't pinned the version of redis due to which the version of redis got upgraded. 

celery issue for reference
celery/celery#5175
chrisb-c01 pushed a commit to PrecedenceBV/flask-redis that referenced this issue Nov 19, 2018
chrisb-c01 pushed a commit to PrecedenceBV/flask-redis that referenced this issue Nov 19, 2018
Ladsgroup added a commit to wikimedia/ores that referenced this issue Nov 21, 2018
Ladsgroup added a commit to wikimedia/ores that referenced this issue Nov 21, 2018
@greuff
Copy link

greuff commented Nov 21, 2018

Pipenv users: add redis = "~=2.10.6" before the celery entry in the Pipfile.

@auvipy
Copy link
Member

auvipy commented Nov 22, 2018

it's fixed in kombu and celery master

@auvipy auvipy closed this as completed Nov 22, 2018
abretaud added a commit to baricadr/baricadr that referenced this issue Nov 22, 2018
tomashudeckiwi added a commit to kiwicom/phoenix that referenced this issue Nov 23, 2018
nijel added a commit to WeblateOrg/docker that referenced this issue Nov 23, 2018
To avoid problems with 3.0 release, see celery/celery#5175

Signed-off-by: Michal Čihař <michal@cihar.com>
@alexandernst
Copy link

Can we get a patch release for celery?

@17816123046
Copy link

Not a celery issue - Seems to be an issue with Redis 3.0.0.post1 installed via pip.

Solution: Roll back redis with pip: pip install redis==2.10.6

everything working again for me.

thanks

pcaisse added a commit to PublicMapping/districtbuilder-classic that referenced this issue Dec 4, 2018
Redis is used as a message broker for Celery. Celery was not pinning
properly to Redis and there was an issue with Redis 3.0.0.post1. This
pins our secondary Redis dependency to 2.10.6.

See celery/celery#5175
realitygaps added a commit to realitygaps/pretalx that referenced this issue Dec 5, 2018
This is needed for using with pretalx-docker due to pretalx#534 and celery/celery#5175
qiaocco pushed a commit to qiaocco/django-blog that referenced this issue Dec 7, 2018
benjaoming added a commit to benjaoming/2019.djangocon.eu that referenced this issue Dec 16, 2018
@wadkar
Copy link

wadkar commented Dec 17, 2018

Can we get a patch release for celery?

A patch release would be great!!!

Is there something the community can do to make it possible sooner rather than later? As you can see, many related projects are referring to this issue and pinning down the redis version.

@thedrow
Copy link
Member

thedrow commented Dec 18, 2018

I did release a patch for kombu. It should resolve the issue.
Please subscribe for release notifications on our repositories instead of pinging us.

jact added a commit to migasfree/migasfree-backend that referenced this issue Dec 19, 2018
andreymal added a commit to andreymal/mini_fiction that referenced this issue Jan 19, 2019
@richardsonlima
Copy link

Not a celery issue - Seems to be an issue with Redis 3.0.0.post1 installed via pip.

Solution: Roll back redis with pip: pip install redis==2.10.6

everything working again for me.

Worked thank you !!

@congkhoa
Copy link

It should be fixed in newest update: Celery 4.3.0 (kobu 4.5.0).
You don't need to rollback redis version.

@bangdasun
Copy link

It should be fixed in newest update: Celery 4.3.0 (kobu 4.5.0).
You don't need to rollback redis version.

True, this works in my case.

@dhanashri88
Copy link

dhanashri88 commented Jul 19, 2020

Hi,
I am getting issue AttributeError: 'float' object has no attribute 'item'
while executing call back function callbacks = [checkpointer, earlystopper, lr_reducer, TensorBoardColabCallback(tbc)]
which call /usr/local/lib/python3.6/dist-packages/tensorboardcolab/callbacks.py
I have install install redis==2.10.6 still issue persist.
I am using google colab.

@wadkar
Copy link

wadkar commented Jul 21, 2020

@dhanashri88 - I don't think this is a Celery issue. Your issue report/tracceback is not complete, but it looks like this is a tensorboard issue. Please ask their support channel/mailing list/github issues for help.

@AleksSpace
Copy link

Traceback (most recent call last):
   File "/usr/local/lib/python3.6/site-packages/celery/worker/worker.py", line 203, in start
     self.blueprint.start(self)
   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start
     step.start(parent)
   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 370, in start
     return self.obj.start()
   File "/usr/local/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 320, in start
     blueprint.start(self)
   File "/usr/local/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start
     step.start(parent)
   File "/usr/local/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 596, in start
     c.loop(*c.loop_args())
   File "/usr/local/lib/python3.6/site-packages/celery/worker/loops.py", line 88, in asynloop
     next(loop)
   File "/usr/local/lib/python3.6/site-packages/kombu/async/hub.py", line 354, in create_loop
     cb(*cbargs)
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 1040, in on_readable
     self.cycle.on_readable(fileno)
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 337, in on_readable
     chan.handlers[type]()
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 724, in _brpop_read
     self.connection._deliver(loads(bytes_to_str(item)), dest)
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 981, in _deliver
     callback(message)
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/virtual/base.py", line 632, in _callback
     self.qos.append(message, message.delivery_tag)
   File "/usr/local/lib/python3.6/site-packages/kombu/transport/redis.py", line 149, in append
     pipe.zadd(self.unacked_index_key, time(), delivery_tag) \
   File "/usr/local/lib/python3.6/site-packages/redis/commands/core.py", line 4005, in zadd
     for pair in mapping.items():
 AttributeError: 'float' object has no attribute 'items'

python==3.6.14, celery==4.1.0, redis==4.3.6
Help me please!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests