Closed emacsen closed 7 years ago
Hi, I just ran into the same problem. Make sure that you are not accidentally using the django-channels
package, which is unrelated, but rather the channels
package.
This was indeed the problem. The issue on the github is that while the link is right, the dependecy is written as django-channels.
I have the same error. I have tried pip install channels
but still there is ImportError: cannot import name Group
error
Installing channel instead of django-channel worked for me!
Worked for me too!
I am using channels==2.0.2 and getting the same error while trying to import Group.
I have this problem too. Any solution yet? I'm only using channels not django-channels
@Hey-tom : In channels 2, Group has been removed.
Little green to Django. What module should I be importing if Group has been deprecated from channels? I've looked up documentation, but nothing I've found clearly states what I should do to replace "from channels import Group." For example,
models.py
def group_notification(self, activity): Group('notifications').send({ 'text': json.dumps({ 'username': self.user.username, 'activity_type': 'notification', 'activity': activity }) {)
replace with...
from channel.layers import get_channel_layer
def group_notification(self, activity): pass_info = json.dumps({ 'username': self.user.username, 'activity_type': 'notification', 'activity': activity}) await self.channel_layer.group_send("notification",pass_info)
I get an attribute error re: channel_layer
Same problem. Using:
Python 3.6.2 channels==2.1.1 Django==2.0.4 django-channels-presence==0.0.9
Added as the doc says to:
INSTALLED_APPS = [
...
"channels_presence",]
manage.py runserver
produces:
File "C:\ENV_CH~1\lib\site-packages\channels_presence\models.py", line 12, in <module>
from channels import Group
ImportError: cannot import name 'Group'
Am I missing something?
@alexalexyang Group has been deprecated in channels 2.
I'm installing this module and trying to use it, but on any command such as makemigrations or migrate, I get:
(tmpchat) emacsen@thinkpad:~/tmp/tmpchat$ ./manage.py makemigrations Traceback (most recent call last): File "./manage.py", line 22, in
execute_from_command_line(sys.argv)
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/django/core/management/init.py", line 363, in execute_from_command_line
utility.execute()
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/django/core/management/init.py", line 337, in execute
django.setup()
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/django/init.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 673, in _load_unlocked
File "", line 665, in exec_module
File "", line 222, in _call_with_frames_removed
File "/home/emacsen/.virtualenvs/tmpchat/lib/python3.5/site-packages/channels_presence/models.py", line 12, in
from channels import Group
ImportError: cannot import name 'Group'
This is with Python 3.5 but I get the same error with 2.7. Also this is django 1.11.
Any help would be appreciated