ImportError: cannot import name 'Callable' from 'collections'

When I runserver , I got this error

Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python310\lib\", line 1009, in _bootstrap_inner
  File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python310\lib\", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\utils\", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\core\management\commands\", line 110, in inner_run
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\utils\", line 87, in raise_last_exception
    raise _exception[1]
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\core\management\", line 375, in execute
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\utils\", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\", line 24, in setup
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\apps\", line 114, in populate
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\django\apps\", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\XXXXXX\AppData\Local\Programs\Python\Python310\lib\importlib\", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\XXXXXX\Desktop\spine\qualityManagement\", line 2762, in <module>
    from audiofield.fields import AudioField
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\audiofield\", line 20, in <module>
    from celery.utils.log import get_task_logger
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\celery\utils\", line 10, in <module>
    from .nodenames import worker_direct, nodename, nodesplit
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\celery\utils\", line 9, in <module>
    from .text import simple_format
  File "C:\Users\XXXXXX\Desktop\myenv\lib\site-packages\celery\utils\", line 5, in <module>
    from collections import Callable
ImportError: cannot import name 'Callable' from 'collections' (C:\Users\XXXXXX\AppData\Local\Programs\Python\Python310\lib\collections\

What versions of Python, Django, AudioField, and Celery are you using?
From what I can quickly see, AudioField hasn’t been updated in 3 years and may not be compatible with current Django.

What can I use instead of AudioField?


You can:

  • Fork AudioField and bring it up-to-date yourself.
  • Use it as inspiration and ideas for your own implementation.
  • Try to contact the original author of the package to see if they have any interest in bringing it up to date.
  • Look for another package.
1 Like

See the Notes at the top of First steps with Django — Celery 5.2.1 documentation. You no longer need django-celery. What version of Celery are you using?