Skip to content

ImportError: Could not import 'rest_framework_json_api.django_filters.DjangoFilterBackend' for API setting 'DEFAULT_FILTER_BACKENDS' #679

@JonForest

Description

@JonForest

I've just started a new project with a Python 3.7.2 virtual env.

Results of a freeze are:
➜ mysite pip freeze
Django==2.2.3
djangorestframework==3.10.1
djangorestframework-jsonapi==2.8.0
inflection==0.3.1
pytz==2019.1
six==1.12.0
sqlparse==0.3.0

I've added the default SETTINGS from the docs.

If I then

> python manage.py shell

>>> from rest_framework_json_api import views

Then I get an error thrown

Traceback (most recent call last):
  File "/Users/jonathanhollingsworth/.virtualenvs/dja-manual-test/lib/python3.7/site-packages/rest_framework/settings.py", line 177, in import_from_string
    return import_string(val)
  File "/Users/jonathanhollingsworth/.virtualenvs/dja-manual-test/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "/Users/jonathanhollingsworth/.virtualenvs/dja-manual-test/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/jonathanhollingsworth/.virtualenvs/dja-manual-test/lib/python3.7/site-packages/rest_framework_json_api/django_filters/__init__.py", line 1, in <module>
    from .backends import DjangoFilterBackend  # noqa: F401
  File "/Users/jonathanhollingsworth/.virtualenvs/dja-manual-test/lib/python3.7/site-packages/rest_framework_json_api/django_filters/backends.py", line 3, in <module>
    from django_filters import VERSION
ModuleNotFoundError: No module named 'django_filters'

Not sure where to go next with this one.
Am happy to put up the failing minimal case as a public repo if that is helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions