ImportError: cannot import name JSONField
See original GitHub issueI haven’t managed to install the package.
#settings.py
INSTALLED_APPS = (
...
'json_field',
...
)
#models.py
from json_field import JSONField
from django.db import models
...
class Human(models.Model):
phone_numbers = JSONField()
and when doing south migration:
File "<...>/models.py", line 2, in <module>
from json_field import JSONField
ImportError: cannot import name JSONField
I tried Django shell
(test)Dae-MacPro:test Dae$ python manage.py shell
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from json_field import JSONField
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: cannot import name JSONField
I’m using Django 1.4. I tried installing from repo and pip, no difference.
What might be the problem?
Thanks
Issue Analytics
- State:
- Created 11 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
cannot import name jsonfield from django_mysql.models
importerror: cannot import name jsonfield from django_mysql.models error generates because of keeping the lower version of Django module.
Read more >ImportError: cannot import name 'JSONField' - Stack Overflow
when I run python manage.py runserver 0.0.0.0:8888 . Even though I already have simplejson installed. pip freeze shows, alabaster==0.7 ...
Read more >[Answered]-ImportError: cannot import name 'JSONField'-django
I'm getting the error: File "/home/mark/Nova/nova/lib/fields.py", line 1, in <module> from django.contrib.postgres.fields import JSONField ImportError: ...
Read more >python-django-jsonfield: FTBFS: ImportError: cannot import ...
Debian Bug report logs - #1013493 python-django-jsonfield: FTBFS: ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation ...
Read more >ImportError: cannot import name 'JSONField'问题解决
ImportError : cannot import name 'JSONField'问题解决新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I believe
dateutil
is the problem. It is not installed by default on Mac or Windows systems (and possibly some Linux distributions as well). I’m updating the documentation to reflect this.Please run
pip install python-dateutil
No problem! Also, I just updated the code to remove the unintended dependency on
simplejson
so you should be alright now in either case.