21

I installed Redis version 4.0.9 in a Ubuntu Linux Subsystem on Windows 10 by following these instructions (i.e. sudo apt-get install redis-server).

I am following this tutorial on Django channels, and I ran the following code:

>>> import channels.layers
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
>>> async_to_sync(channel_layer.receive)('test_channel')

When the last line above is executed, I get this error:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\asgiref\sync.py", line 120, in __call__
    return call_result.result()
  File "C:\Users\xyz\Anaconda3\envs\django\lib\concurrent\futures\_base.py", line 425, in result
    return self.__get_result()
  File "C:\Users\xyz\Anaconda3\envs\django\lib\concurrent\futures\_base.py", line 384, in __get_result
    raise self._exception
  File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\asgiref\sync.py", line 180, in main_wrap
    result = await self.awaitable(*args, **kwargs)
  File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 485, in receive
    return (await self.receive_single(channel))[1]
  File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 508, in receive_single
    index, channel_key, timeout=self.brpop_timeout
  File "C:\Users\xyz\Anaconda3\envs\django\lib\site-packages\channels_redis\core.py", line 345, in _brpop_with_clean
    result = await connection.bzpopmin(channel, timeout=timeout)
aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'

On this page, someone suggested using Redis version 5. How do I install Redis version 5 on Windows 10? Any other ideas on how to solve this issue?

2

13 Answers 13

50

I think the problem is in the compatibility with version of the channels-redis package! I had already tested channels some time ago and it worked beautifully with channels-redis version 2.4.2, recently they are in version 3.0.1 and this version doesn't work properly yet I don't know why.

Try install the version 2.4.2 with pip:

pip install channels-redis==2.4.2
Sign up to request clarification or add additional context in comments.

1 Comment

just update the redis server, it will fix the issue.
16

Use redis 5.0.9. It worked for for the same error.

Get it from github.com/tporadowski/redis/releases

Comments

11

Just download the latest version of Redis for Windows https://github.com/tporadowski/redis/releases from here it will work.

you don't need to downgrade the version of your channels-redis etc. This problem with Redis not with any python packages at all.

4 Comments

Does it only support 64 -bit? I needed for 32-bit, no clue where to get one. I'm also using windows 7 which makes it worse to find.
@justbeingalearner look at this. stackoverflow.com/questions/57536012/… and install the same redis that I have given the link
I tried installing but it's saying 64 bit is not supported.
@justbeingalearner you must update to window 10 then it will definitely work
10

You need to install the latest version(6+) of redis:

$ sudo add-apt-repository ppa:redislabs/redis
$ sudo apt-get update
$ sudo apt-get install redis

then restart the redis-server.

1 Comment

This should be accepted answer as it allows latest versions of channels and channels-redis
9

There is no official support for Redis in Windows OS.

However, Microsoft develops and maintains microsoftarchive/redis. Also it is no longer supported (older versions are availble). I had long search on this about installing version 5 in windows 10. But no luck.

Better you can go for Memurai. Memurai is 100% compatible with the Redis protocol (also supported version 5 too). It is free for development and testing.

EDIT : From Itamar comment, u can also use this as alternative for Memurai

3 Comments

I don't think github.com/tporadowski/redis is closer to Redis than Memurai is. They both derive from the (now abandoned) MS Open Tech port, and Memurai was the first to have Redis 5.x compatibility. Memurai also supports the BZPOPMIN command.
Installing Memurai has fixed my problem. Thanks!
An alternative OSS project is github.com/tporadowski/redis. I'm now aware that Memurai supports BZPOPMIN.
2

This is how i resolve this issue. Ubuntu 18 installs redis 4 but ubuntu 20 installs redis 5. You can find your redis version by typing redis-cli -v. So i uninstall ubuntu 18 from my windows subsystem for linux (WSL) and reinstall ubuntu 20. It worked just fine.

Comments

2

Same problem on Ubuntu 16.04

Similarly, I was following the chat application tutorial on Django Channels website and had the same error:

aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN'

The problem occurred when I used these versions:

redis-server==3.0.6
channels==3.0.3
channels-redis==3.2.0

Thanks to @marvin-correia for his answer I figured out the problem's reason is the version of the channels-redis package! So as he suggested, I installed channel-redis version 2.4.2 and the error has gone.

pip install channels-redis==2.4.2

Also, I've to note that channels package downgraded to channels==2.4.0 automatically.

Comments

0

Problem is with the version. Try older one I found "2,3,4" any version with it stable and properly working. https://github.com/tporadowski/redis/releases

Comments

0

To add to @Marvin answer, for me it was similar (some versioning problem probably), I reinstalled django_channels and django to the exact version as specified in the tutorial (3.0, 2.2) and it worked. Not sure what exactly worked but recommend checking it:)

Comments

0

I will also confirm Marvins answer. Hopefully this will help someone out but also leaving this here for notes.

Development:

(this setup works) considering data is sent to and form http://localhost:8000

Setup

Windows 10 Running WSL with Ubuntu 20.04

  • Python==3.10
  • Django==4.0
  • Redis==5.0.7
  • channels-redis==3.3.1

Production

setup

  • Python==3.8
  • Ubuntu==16.04
  • Redis-server==3.0.6
  • chanels-redis==2.4.2
  • channels==3.0.3

When I downgraded, channels-redis, it automcatically downgraded channels as well. Then you can force the upgrade to channels==3.0.3, but it will raise an incompatibility error. Also, if 2 files will most likely to be updated to run Django 4.0

1 being here https://github.com/django/channels/issues/1609

Comments

0

I was getting this error on a Windows machine, I would suggest you to use Redis on a docker image instead of using Redis server on a windows machine.

One of the way to run a redis server via a docker image and map the port 6379 is to:

  1. start docker desktop

  2. In your terminal type the below command.

    docker run -p 6379:6379 -d redis:5

Comments

0

now, this is the recent post about this issue.

this is the version issue like above. but the main issue is redis-server version(too latest)

succeed :

Django==5.1.6
channels==4.2.0
channels_redis==4.2.1

and

redis --version : 5.0.14.1

(windowed version of that, use this version download_link)

at now, the latest redis version is

redis --version 7.4.1

(in wsl, using ubuntu 24.0.2)

good luck!

Comments

0

I am using redis-server 5.0.8. It works fine with python: channels_redis 4.2.1 and redis 5.2.1.

The early used redis-server 3.2.12 had such 'BZPOPMIN' issue.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.