Repository: django-json-api/django-rest-framework-json-api

Issue:
v2.3 ImportError: No module named 'six'
I upgraded from v2.2 to 2.3 and I'm receiving the error indicated in the subject when I run Django server.

Stack trace: 

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f06651deb70>
Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/settings.py", line 180, in import_from_string
    module = import_module(module_path)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework_json_api/parsers.py", line 9, in <module>
    from . import exceptions, renderers, serializers, utils
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework_json_api/serializers.py", line 8, in <module>
    from rest_framework_json_api.relations import ResourceRelatedField
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework_json_api/relations.py", line 6, in <module>
    import six
ImportError: No module named 'six'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/vagrant/src/joyrides/joyrides_snake/joyrides_snake/urls.py", line 22, in <module>
    url(r'^api/amenities', include('amenities.urls')),
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/vagrant/src/joyrides/joyrides_snake/amenities/urls.py", line 3, in <module>
    from . import views
  File "/vagrant/src/joyrides/joyrides_snake/amenities/views.py", line 1, in <module>
    from rest_framework.views import APIView
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/views.py", line 100, in <module>
    class APIView(View):
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/views.py", line 104, in APIView
    parser_classes = api_settings.DEFAULT_PARSER_CLASSES
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/settings.py", line 223, in __getattr__
    val = perform_import(val, attr)
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/settings.py", line 168, in perform_import
    return [import_from_string(item, setting_name) for item in val]
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/settings.py", line 168, in <listcomp>
    return [import_from_string(item, setting_name) for item in val]
  File "/home/ubuntu/.virtualenvs/joyrides_snake/lib/python3.5/site-packages/rest_framework/settings.py", line 184, in import_from_string
    raise ImportError(msg)
ImportError: Could not import 'rest_framework_json_api.parsers.JSONParser' for API setting 'DEFAULT_PARSER_CLASSES'. ImportError: No module named 'six'.


Discussion:
@skeezus thanks for the report. It looks like we added `six` but failed to list it as a required dependency in the packaging. I'll push out a patch release shortly.

Resolving patch:
diff --git a/rest_framework_json_api/__init__.py b/rest_framework_json_api/__init__.py
--- a/rest_framework_json_api/__init__.py
+++ b/rest_framework_json_api/__init__.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 __title__ = 'djangorestframework-jsonapi'
-__version__ = '2.3.0'
+__version__ = '2.3.1'
 __author__ = ''
 __license__ = 'MIT'
 __copyright__ = ''
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -101,6 +101,7 @@ def get_package_data(package):
         'inflection>=0.3.0',
         'djangorestframework>=3.1.0',
         'django',
+        'six',
     ],
     setup_requires=pytest_runner + sphinx + wheel,
     tests_require=[


Test patch: