DRF ImportError: cannot import name 'action' on v3.8.2
My virtual environment and docker container were not using the same django rest framework version. I had to ssh into my docker container via docker exec -it <container_id> bash and run pip install djangorestframework --upgrade this gave me the 3.8.2 version I was looking for.
Docker installed 3.4.7 because I used to have djangorestframework<3.5 in the requirements file and the container was stored in that state. I could have deleted the container and rerun docker-compose up to recreate the container with the newer version of 3.8.2. I of course opted to just upgrade with pip instead.
Why am I getting this error? I'm running v 3.8.2 of DRF. I'm wondering if docker has anything to do with it. Maybe the interpreter is trying to use/find some other installation I have on my machine. Any suggestions/help would be great. Thanks
This line is failing
from rest_framework.decorators import action
I'm replacing the list_route method to action on this line
@action(methods=['POST'], permission_classes=[IsAuthenticated, ])
I'm running a virtualenv created in pycharm and running pip freeze gives me:

$ pip freeze
...
Django==1.10.8
django-extensions==2.1.0
django-rest-swagger==2.2.0
django-widget-tweaks==1.4.1
djangorestframework==3.8.2
...


backend_1   | Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fa4163708c8>
backend_1   | Traceback (most recent call last):
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
backend_1   |     fn(*args, **kwargs)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run
backend_1   |     self.check(display_num_errors=True)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 374, in check
backend_1   |     include_deployment_checks=include_deployment_checks,
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 361, in _run_checks
backend_1   |     return checks.run_checks(**kwargs)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
backend_1   |     new_errors = check(app_configs=app_configs)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/checks/urls.py", line 14, in check_url_config
backend_1   |     return check_resolver(resolver)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/core/checks/urls.py", line 24, in check_resolver
backend_1   |     for pattern in resolver.url_patterns:
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
backend_1   |     res = instance.__dict__[self.name] = self.func(instance)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/urls/resolvers.py", line 313, in url_patterns
backend_1   |     patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
backend_1   |     res = instance.__dict__[self.name] = self.func(instance)
backend_1   |   File "/usr/local/lib/python3.6/site-packages/django/urls/resolvers.py", line 306, in urlconf_module
backend_1   |     return import_module(self.urlconf_name)
backend_1   |   File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
backend_1   |     return _bootstrap._gcd_import(name[level:], package, level)
backend_1   |   File "<frozen importlib._bootstrap>", line 978, in _gcd_import
backend_1   |   File "<frozen importlib._bootstrap>", line 961, in _find_and_load
backend_1   |   File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
backend_1   |   File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
backend_1   |   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
backend_1   |   File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
backend_1   |   File "/project_backend/project_backend/urls.py", line 20, in <module>
backend_1   |     from apps.app_name.views import XYZViewSet
backend_1   |   File "/project_backend/apps/app_name/views.py", line 4, in <module>
backend_1   |     from rest_framework.decorators import action
backend_1   | ImportError: cannot import name 'action'