question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding'

See original GitHub issue

django-mailbox==4.8.1

When running python manage.py migrate django_mailbox after installation and adding django_mailbox to INSTALLED_APPS, this error is returned

python manage.py migrate django_mailbox
Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    main()
  File "manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/core/management/__init__.py", line 377, in execute
    django.setup()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
    app_config.import_models()
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/joseph.peterson/Development/help-desk/env-helpdesk/lib/python3.7/site-packages/django_mailbox/models.py", line 31, in <module>
    from django.utils.encoding import python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
chaotikacommented, Apr 14, 2020

I can confirm this for 4.8.1 when i install it via pip directly or with git from pip. Installation with pip3 install git+https://github.com/coddingtonbear/django-mailbox.git@c8751f0c9ae85e43f8e775e21dc5ad26adc7f459 it works.

0reactions
mkayandercommented, Jun 2, 2020

Yes, installing the latest version from git solves the problem for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'python_2_unicode_compatible' from ' ...
ImportError : cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' #504. Open.
Read more >
python - from django.utils.encoding import ...
from django.utils.encoding import python_2_unicode_compatible ImportError: cannot import name 'python_2_unicode_compatible'.
Read more >
cannot import name 'python_2_unicode_compatible' from ' ...
ImportError : cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' ... To complete the tutorial, try installing an older ...
Read more >
Pinax Importerror Cannot Import Name ...
import error installing with django 3.0.4: cannot import name 'python2unicodecompatible' from 'django.utils.encoding Issue: Django 3 has.
Read more >
ImportError: cannot import name 'force_str' from partially ...
So far I have dones these things: from django.utils.encoding import force_str. Manuall chagned everything that was force_text_ to force_str.
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