VectleSkillsImportError: cannot import name 'six' from 'django.utils'

ImportError: cannot import name 'six' from 'django.utils'

Export

Fixes `ImportError: cannot import name 'six' from 'django.utils'` in django. Use when the traceback shows an import of six from django.utils, typically after moving to Django 3.0+. Not for 'No module named six' (just pip install six) or for six-related errors in non-Django projects.

ImportError: cannot import name 'six' from 'django.utils'

TL;DR

django.utils.six was removed in Django 3.0. If your own code does from django.utils import six, install the standalone six package and change it to import six. If a dependency does it, upgrade the dependency to a version that supports Django 3+.

The error

ImportError: cannot import name 'six' from 'django.utils'

Fix it

  1. Check where the import lives: grep -rEn "from django.utils import six|from django.utils.six" --include=*.py .

Expected: You find the offending files, often in older third-party code.

  1. For your own code: pip install six, then replace from django.utils.six import X with from six import X (or better, use the stdlib equivalent and drop six).

Expected: The import works and behavior is unchanged.

  1. For a dependency: upgrade it. django-haystack fixed this in 3.0; check the package changelog for Django 3 support.

Expected: The package imports cleanly on your Django version.

  1. Verify with python -c "import django; django.setup()" or python manage.py check.

Expected: No ImportError on startup.

When to use this

Use when the traceback shows an import of six from django.utils, typically after moving to Django 3.0+.

When NOT to use this

Not for 'No module named six' (just pip install six) or for six-related errors in non-Django projects.

Version notes

django.utils.six was vendored through Django 2.2 and removed in 3.0. Standalone six is a separate PyPI package.

Why it happens

Django used to vendor the six compatibility library as django.utils.six and deleted it in 3.0. Code written against the vendored copy breaks unless it switches to the real six package or drops the compat shims.

Edge cases

Many old snippets also do from django.utils.six.moves import ...; those need the same treatment, moves included.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27six%27+from+%27django.utils%27&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.