ImportError: cannot import name 'DEFAULT_CHANNEL_LAYER'

See original GitHub issue

I cannot say I’m good at submitting issues etc. But I’m going to try it. So I hope this will help. I just faced an error when I’m trying to run the databinding example which is in your channels-examples repo.

My channels version is 0.17.2 and I installed it from pip. Here is the error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/usr/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib/python3.5/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/usr/lib/python3.5/site-packages/django/apps/config.py", line 199, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/lexygon/Downloads/channels-examples-master/databinding/values/models.py", line 2, in <module>
    from channels.binding.websockets import WebsocketBinding
  File "/usr/lib/python3.5/site-packages/channels/binding/__init__.py", line 1, in <module>
    from .base import Binding  # NOQA isort:skip
  File "/usr/lib/python3.5/site-packages/channels/binding/base.py", line 8, in <module>
    from ..channel import Group
  File "/usr/lib/python3.5/site-packages/channels/channel.py", line 5, in <module>
    from channels import DEFAULT_CHANNEL_LAYER, channel_layers
ImportError: cannot import name 'DEFAULT_CHANNEL_LAYER'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
globophobecommented, Aug 14, 2016

Did you by chance use pip install django_channels? I did the same at first. Try pip install channels.

This other project shares the same namespace: https://github.com/ymyzk/django-channels

0reactions
Akarsh711commented, Nov 17, 2022

try changing your settings add ‘daphne’ instead of channels

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
cannot import name 'Channel' from 'channels' - Stack Overflow
I'm ran into the same error with unit tests. # Chat/tests.py from channels import Channel from channels.test import ChannelTestCase class ...
Read more >
ImportError: cannot import name 'default' - Google Groups
When trying to start Jupyter with the command Jupyter Notebook, I am getting this below error: File "/anaconda/bin/jupyter-notebook", line 4, in <module> ...
Read more >
How do I fix the ImportError: cannot import name 'delayed'?
I am using the LORAS package from pyloras for imbalanced learning, but it requires importing the delayed package. I used the pip.main() to ......
Read more >
How to Fix : “ImportError: Cannot import name X” in Python?
You can solve the “ ImportError : Cannot import name X” Error by resolving the circular dependencies. You can do that either by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found