73π
My pip version was old, really old. 1.5.6 When I installed my virtual environment it just worked, so I didnβt question. Lesson learned! Here is what I did in case it helps someone elseβ¦
In the virtual environment, I installed pip as described in the docs:
https://pip.pypa.io/en/stable/installing.html
python get-pip.py
This upgraded me to pip 6.1.1
pip install django-filter
pip freeze > requirements.txt
Reading requirements.txt showed I had
django-filter==0.9.2
django-filters==0.1.0
So I uninstalled the older version with pip uninstall django-filters
notice the s on the older version but not on the new one
Really basic stuff but it really tripped me up. Thanks to anyone who took time to look into this!
13π
I also had the same issue. Even after installing django-filters
I couldnβt import it
ImportError: No module named django_filters
The Django version Iβm using is 1.8 and python version is 2.7.x
Solution is to install djangorestframework-filters
pip install djangorestframework-filters
The names are very confusing.
However django-rest-framework-filters
is an extension to Django REST framework and Django filter that makes it easy to filter across relationships while Django-filter
is a reusable Django application allowing users to declaratively add dynamic QuerySet filtering from URL parameters.
- [Django]-Django south migration β Adding FULLTEXT indexes
- [Django]-Automatic creation date for Django model form objects
- [Django]-Django URL Redirect
12π
I also encountered this issue installing django-filter==2.2.0
This was my Django version:
Django [required: >=1.11, installed: 2.2]
settings.py:
INSTALLED_APPS = [
# ...
'django_filter',
]
This is the correct installation:
pipenv install django-filter
- [Django]-How to detect Browser type in Django?
- [Django]-Get model's fields in Django
- [Django]-ModuleNotFoundError: No module named 'grp' on windows
4π
I changed from django_filter
to django_filters
in installed apps and it was okay.
- [Django]-Django β Get only date from datetime.strptime
- [Django]-How to expire Django session in 5minutes?
- [Django]-Django {% with %} tags within {% if %} {% else %} tags?
3π
I had a similar issue using django 1.7, djangorestframework==3.2.0 and latest django-filter==0.13.0:
Using DjangoFilterBackend, but django-filter is not installed
cannot import name Expression
I finally fixed it by downgrading django-filter to 0.11.
Now pip freeze looks like this and its working:
Django==1.7
django-filter==0.11.0
djangorestframework==3.2.0
- [Django]-How to create a user in Django?
- [Django]-Django : Can't import 'module'. Check that module AppConfig.name is correct
- [Django]-Django dynamic model fields
1π
We install it using: pip install django-filter
or in case you are using a virtual environment like pipenv, use pipenv install django-filter .
the above install, adds the latest version of django-filter. Add "==version" to specify the version ( say 0.11.0) you need
In the settings.py under app, ensure itβs 'django_filters',
INSTALLED_APPS = [
# ...
'django_filters',
]
- [Django]-Using Basic HTTP access authentication in Django testing framework
- [Django]-POST jQuery array to Django
- [Django]-How do I display the value of a Django form field in a template?
1π
I tried all of the above answers and none of them worked for me. I later learnt that the pip script is not installing modules for the interpreter that the python command is using.
SOLUTION:
python -m pip install django-filter
- [Django]-Deploying Django with gunicorn and nginx
- [Django]-How do I use a dictionary to update fields in Django models?
- [Django]-What is the path that Django uses for locating and loading templates?
0π
Ensure its django_filters
and not django-filters
in settings.py. Also keep in find itβs not django-filter
, itβs django-filters
.
But to install it:
pip install django-filter
- [Django]-Django override save for model only in some cases?
- [Django]-Serving Media files during deployment in django 1.8
- [Django]-Django REST Framework upload image: "The submitted data was not a file"
0π
I removed django_filters
in the settings INSTALLED_APPS
. this is worked for me
- [Django]-Django: Filter a Queryset made of unions not working
- [Django]-How do I restart celery workers gracefully?
- [Django]-Google Static Maps URL length limit
0π
I also experienced the same problem but i realized its because i had installed django-filter when am in the virtual environment.
I tried installing django-filter at the same directory without activating the virtual environment and it worked
I used
pip install django-filter
- [Django]-How to change empty_label for modelForm choice field?
- [Django]-Backwards migration with Django South
- [Django]-How to customize activate_url on django-allauth?
0π
In my case, the issue was Interpreter, After wasting a day finally resolved the issue. Always check you are selecting the right Interpreter. I was getting this error before fixing the issue:
"django_filters" is not accessedPylance
Import "django_filters" could not be resolvedPylancereportMissingImports
Though I see requirment.txt showing django_filters 23.1
- [Django]-In the Django admin interface, is there a way to duplicate an item?
- [Django]-Django REST Framework (DRF): Set current user id as field value
- [Django]-Django: How to get related objects of a queryset?