Python ImportError after upgrade to 2.4.4 #1966

Closed
opened 2025-12-29 17:20:59 +01:00 by adam · 1 comment
Owner

Originally created by @iDemonix on GitHub (Aug 22, 2018).

I have upgraded from 2.3.2 to 2.4.4. I've done multiple upgrades, and followed the docs as standard again. The upgrade.sh script ran successfully, however it wouldn't start due to some missing taggit modules which I installed with pip.

Now whenever I start, it runs, and does not crash, but not requests are served. Each request results in the following in the console:

[root@netbox netbox]$ gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi
[2018-08-22 21:38:00 +0000] [55049] [INFO] Starting gunicorn 19.7.1
[2018-08-22 21:38:00 +0000] [55049] [INFO] Listening at: http://127.0.0.1:8001 (55049)
[2018-08-22 21:38:00 +0000] [55049] [INFO] Using worker: sync
[2018-08-22 21:38:00 +0000] [55054] [INFO] Booting worker with pid: 55054
[2018-08-22 21:38:00 +0000] [55055] [INFO] Booting worker with pid: 55055
[2018-08-22 21:38:00 +0000] [55056] [INFO] Booting worker with pid: 55056
WARNING: yacc table file version is out of date
WARNING: yacc table file version is out of date
WARNING: yacc table file version is out of date

[2018-08-22 21:38:19 +0000] [55054] [ERROR] Error handling request /
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 157, in __call__
    response = self.get_response(request)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 43, in inner
    response = response_for_exception(request, exc)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 142, in handle_uncaught_exception
    callback, param_dict = resolver.resolve_error_handler(500)
  File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 418, in resolve_error_handler
    callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 48, in <module>
    url(r'^api/circuits/', include('circuits.api.urls')),
  File "/usr/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/circuits/api/urls.py", line 5, in <module>
    from . import views
  File "/opt/netbox/netbox/circuits/api/views.py", line 4, in <module>
    from rest_framework.decorators import action
ImportError: cannot import name action

[2018-08-22 21:40:01 +0000] [55054] [ERROR] Error handling request /api/dcim/devices/?manufacturer=juniper&limit=10000
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 157, in __call__
    response = self.get_response(request)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 43, in inner
    response = response_for_exception(request, exc)
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 142, in handle_uncaught_exception
    callback, param_dict = resolver.resolve_error_handler(500)
  File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 418, in resolve_error_handler
    callback = getattr(self.urlconf_module, 'handler%s' % view_type, None)
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/netbox/urls.py", line 48, in <module>
    url(r'^api/circuits/', include('circuits.api.urls')),
  File "/usr/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/netbox/netbox/circuits/api/urls.py", line 5, in <module>
    from . import views
  File "/opt/netbox/netbox/circuits/api/views.py", line 4, in <module>
    from rest_framework.decorators import action
ImportError: cannot import name action
Originally created by @iDemonix on GitHub (Aug 22, 2018). I have upgraded from 2.3.2 to 2.4.4. I've done multiple upgrades, and followed the docs as standard again. The `upgrade.sh` script ran successfully, however it wouldn't start due to some missing `taggit` modules which I installed with pip. Now whenever I start, it runs, and does not crash, but not requests are served. Each request results in the following in the console: ``` [root@netbox netbox]$ gunicorn -c /opt/netbox/gunicorn_config.py netbox.wsgi [2018-08-22 21:38:00 +0000] [55049] [INFO] Starting gunicorn 19.7.1 [2018-08-22 21:38:00 +0000] [55049] [INFO] Listening at: http://127.0.0.1:8001 (55049) [2018-08-22 21:38:00 +0000] [55049] [INFO] Using worker: sync [2018-08-22 21:38:00 +0000] [55054] [INFO] Booting worker with pid: 55054 [2018-08-22 21:38:00 +0000] [55055] [INFO] Booting worker with pid: 55055 [2018-08-22 21:38:00 +0000] [55056] [INFO] Booting worker with pid: 55056 WARNING: yacc table file version is out of date WARNING: yacc table file version is out of date WARNING: yacc table file version is out of date [2018-08-22 21:38:19 +0000] [55054] [ERROR] Error handling request / Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle self.handle_request(listener, req, client, addr) File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 157, in __call__ response = self.get_response(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 43, in inner response = response_for_exception(request, exc) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info()) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 142, in handle_uncaught_exception callback, param_dict = resolver.resolve_error_handler(500) File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 418, in resolve_error_handler callback = getattr(self.urlconf_module, 'handler%s' % view_type, None) File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 48, in <module> url(r'^api/circuits/', include('circuits.api.urls')), File "/usr/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include urlconf_module = import_module(urlconf_module) File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/circuits/api/urls.py", line 5, in <module> from . import views File "/opt/netbox/netbox/circuits/api/views.py", line 4, in <module> from rest_framework.decorators import action ImportError: cannot import name action [2018-08-22 21:40:01 +0000] [55054] [ERROR] Error handling request /api/dcim/devices/?manufacturer=juniper&limit=10000 Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 135, in handle self.handle_request(listener, req, client, addr) File "/usr/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 176, in handle_request respiter = self.wsgi(environ, resp.start_response) File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 157, in __call__ response = self.get_response(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 43, in inner response = response_for_exception(request, exc) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 93, in response_for_exception response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info()) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 142, in handle_uncaught_exception callback, param_dict = resolver.resolve_error_handler(500) File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 418, in resolve_error_handler callback = getattr(self.urlconf_module, 'handler%s' % view_type, None) File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/netbox/urls.py", line 48, in <module> url(r'^api/circuits/', include('circuits.api.urls')), File "/usr/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include urlconf_module = import_module(urlconf_module) File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/opt/netbox/netbox/circuits/api/urls.py", line 5, in <module> from . import views File "/opt/netbox/netbox/circuits/api/views.py", line 4, in <module> from rest_framework.decorators import action ImportError: cannot import name action ```
adam closed this issue 2025-12-29 17:20:59 +01:00
Author
Owner

@iDemonix commented on GitHub (Aug 23, 2018):

Apologies, this was me forgetting to force the -2 flag on a server that has a lovely mix of Python versions... will be on Docker soon!

@iDemonix commented on GitHub (Aug 23, 2018): Apologies, this was me forgetting to force the `-2` flag on a server that has a lovely mix of Python versions... will be on Docker soon!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1966