When starting my server (python manage.py run server) I get the following error.
File "/Users/thomasallen/PycharmProjects/Channels_and_Signals/venv/lib/python3.9/site-packages/asgi_redis/core.py", line 19, in from asgiref.base_layer import BaseChannelLayer ModuleNotFoundError: No module named 'asgiref.base_layer'
The offending line 19 in .../core.py is
from asgiref.base_layer import BaseChannelLayer
The packages I have installed are: Django 3.2.4 channels 3.0.3 channels-redid 3.2.0 aspired 3.3.4 asgi-redis 1.1.0
I'm not sure where the mismatch is.
It's because asgi_redis
1.1.0 depends on an old version of asgiref
(listed without an upper bound as asgiref>=1.0.0
in their setup.py) which used to have this code. But you have a more recent version installed because Django depends on asgiref >= 3.3.2
.
You shouldn't have both asgi_redis
and channels_redis
installed, they are different versions of the same package. See note in the channels_redis git repo:
Note: Prior versions of this package were called
asgi_redis
and are still available under PyPI as that name if you need them for Channels 1.x projects. This package is for Channels 2 projects only.
Your solution is to not use asgi_redis
and use channels_redis
instead.