ModuleNotFoundError: No module named 'psycopg2'
Probably worth putting a try/except around optional requirements. Or is this exception comming from Django itself? I don't have Psycopg2 installed on my dev system, if possible I shouldn't need to have it installed.
File "/home/mjs7231/Projects/pushingkarma/pk/apps/stocks/models.py", line 5, in <module>
from jsonfallback.fields import FallbackJSONField
File "/home/mjs7231/.virtualenvs/pk/lib/python3.6/site-packages/jsonfallback/fields.py", line 6, in <module>
from django.contrib.postgres.fields import JSONField, jsonb
File "/home/mjs7231/.virtualenvs/pk/lib/python3.6/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
from .array import * # NOQA
File "/home/mjs7231/.virtualenvs/pk/lib/python3.6/site-packages/django/contrib/postgres/fields/array.py", line 4, in <module>
from django.contrib.postgres.forms import SimpleArrayField
File "/home/mjs7231/.virtualenvs/pk/lib/python3.6/site-packages/django/contrib/postgres/forms/__init__.py", line 4, in <module>
from .ranges import * # NOQA
File "/home/mjs7231/.virtualenvs/pk/lib/python3.6/site-packages/django/contrib/postgres/forms/ranges.py", line 1, in <module>
from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
ModuleNotFoundError: No module named 'psycopg2'
Any thoughts on this? Currently it means you need to install psycopg2 even if you want to use, say, sqlite.
Could be solved either with conditional imports/lookup registration or a compat module with stubs in the case where the import fails.
Sorry, I somehow missed that. Yeah, it probably could, feel free to contribute! I don't think I'll work a lot on this package given that the amazing @laymonage is currently working on getting full cross-database JSON support into Django itself :)
@raphaelm That is great news that a cross-db JSONField is being considered for core Django.
@laymonage Do you have any WIP branches or anything yet?
amazing is a bit much, but thanks @raphaelm :smile:
Hi @mkjpryor-stfc, I have a PR with a working JSONField here: https://github.com/django/django/pull/11452