Currently I have upgraded version of Django 2.2 to 3.0 and suddenly getting error like below.
ImportError: cannot import name \'six\' from \'django.ut
Short Answer in Django 3.0 just install six:
pip install six
And just use it like:
import six
in order to use the six module you can install it directly using pip and then modify the django-jsonfield package accordingly . What I mean is find the files in the package where there is from django.utils import six
and replace them with import six
. Then it should be working. I faced the same issue when using djongo with django 3.0. I found the respective file and replaced it with the above suggestion. Please note that it is never recommended to do this if you are working on a production level or enterprise level project. I did it for my pet project.
In my case it was django-haystac causing this error. It helped me to upgrade the pip package to the newest beta.
pip install django-haystack==3.0b2
Short answer: you might want to abandon django-jsonfield
.
Based on the traceback, you are using the django-jsonfield package [GitHub], and this is a known issue [GitHub-issue]. It depends on the django.utils.six
module, but that module has been removed in django-3.0.
At the moment, you thus can not use django-3.0 with django-jsonfield, and since the last commit to this project is from October 2017, perhaps the project is not that "active" anymore, and it thus might take a very long time (or even never) get fixed. The successor of django-jsonfield is jsonfield2 ([GitHub]). It was made compatible with django-3.0 by a pull request in October (2019) [GitHub-pr].
A specified in Django 3.0 release note, django.utils.six
is removed.
In case you need it, it is advised to use pypi packages instead
In your case, jsonfield
package might be replaced by native Django's JSON Field.
Another solution would be to fork jsonfield
package yourself to solve you issue, or to make a PR on project's repo'