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 JSONField

See original GitHub issue

I 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:closed
  • Created 11 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
derek-schaefercommented, Jun 29, 2012

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

0reactions
derek-schaefercommented, Jun 29, 2012

No problem! Also, I just updated the code to remove the unintended dependency on simplejson so you should be alright now in either case.

Read more comments on GitHub >

github_iconTop 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 >

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