Failed to upgrade from 2.8 to 2.9 (Error on JSONField) #4012

Closed
opened 2025-12-29 18:32:36 +01:00 by adam · 4 comments
Owner

Originally created by @s-fu on GitHub (Aug 23, 2020).

Environment

  • Python version: 3.6.9
  • NetBox version: 2.8.9 -> 2.9.0/2.9.1

Steps to Reproduce

  1. git checkout master;git pull origin master.
  2. Then run ./upgrade.sh and restart services

Expected Behavior

netbox-rq service start successfully

Observed Behavior

netbox-rq failed with the following error:

root@netbox:/opt/netbox# journalctl -u netbox-rq -f
-- Logs begin at Wed 2019-10-02 16:23:27 PDT. --
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:     from extras.models import ObjectChange
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:   File "/opt/netbox/netbox/extras/models/__init__.py", line 1, in <module>
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:     from .change_logging import ChangeLoggedModel, ObjectChange
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:   File "/opt/netbox/netbox/extras/models/change_logging.py", line 48, in <module>
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:     class ObjectChange(models.Model):
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:   File "/opt/netbox/netbox/extras/models/change_logging.py", line 106, in ObjectChange
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]:     object_data = models.JSONField(
Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: AttributeError: module 'django.db.models' has no attribute 'JSONField'
Aug 22 22:12:37 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE
Aug 22 22:12:37 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Failed with result 'exit-code'.
Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Service hold-off time over, scheduling restart.
Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Scheduled restart job, restart counter is at 2.
Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: Stopped NetBox Request Queue Worker.
Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: Started NetBox Request Queue Worker.
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: Traceback (most recent call last):
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/manage.py", line 10, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     execute_from_command_line(sys.argv)
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     utility.execute()
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 357, in execute
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     django.setup()
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/local/lib/python3.6/dist-packages/django/__init__.py", line 24, in setup
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     apps.populate(settings.INSTALLED_APPS)
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/local/lib/python3.6/dist-packages/django/apps/registry.py", line 114, in populate
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     app_config.import_models()
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/local/lib/python3.6/dist-packages/django/apps/config.py", line 211, in import_models
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     self.models_module = import_module(models_module_name)
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     return _bootstrap._gcd_import(name[level:], package, level)
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap>", line 994, in _gcd_import
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap>", line 971, in _find_and_load
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap_external>", line 678, in exec_module
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/circuits/models.py", line 8, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     from dcim.models import CableTermination
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/dcim/models/__init__.py", line 1, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     from .device_component_templates import *
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/dcim/models/device_component_templates.py", line 7, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     from extras.models import ObjectChange
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/extras/models/__init__.py", line 1, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     from .change_logging import ChangeLoggedModel, ObjectChange
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/extras/models/change_logging.py", line 48, in <module>
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     class ObjectChange(models.Model):
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:   File "/opt/netbox/netbox/extras/models/change_logging.py", line 106, in ObjectChange
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]:     object_data = models.JSONField(
Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: AttributeError: module 'django.db.models' has no attribute 'JSONField'
Aug 22 22:13:08 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE
Aug 22 22:13:08 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Failed with result 'exit-code'.

I tried to put django-jsonfield==1.4.0 in requirements.txt, but still not work

Originally created by @s-fu on GitHub (Aug 23, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.6.9 * NetBox version: 2.8.9 -> 2.9.0/2.9.1 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. git checkout master;git pull origin master. 2. Then run ./upgrade.sh and restart services <!-- What did you expect to happen? --> ### Expected Behavior netbox-rq service start successfully <!-- What happened instead? --> ### Observed Behavior netbox-rq failed with the following error: ``` root@netbox:/opt/netbox# journalctl -u netbox-rq -f -- Logs begin at Wed 2019-10-02 16:23:27 PDT. -- Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: from extras.models import ObjectChange Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: File "/opt/netbox/netbox/extras/models/__init__.py", line 1, in <module> Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: from .change_logging import ChangeLoggedModel, ObjectChange Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: File "/opt/netbox/netbox/extras/models/change_logging.py", line 48, in <module> Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: class ObjectChange(models.Model): Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: File "/opt/netbox/netbox/extras/models/change_logging.py", line 106, in ObjectChange Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: object_data = models.JSONField( Aug 22 22:12:37 netbox.corp.nuro.team python3[13280]: AttributeError: module 'django.db.models' has no attribute 'JSONField' Aug 22 22:12:37 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE Aug 22 22:12:37 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Failed with result 'exit-code'. Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Service hold-off time over, scheduling restart. Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Scheduled restart job, restart counter is at 2. Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: Stopped NetBox Request Queue Worker. Aug 22 22:13:07 netbox.corp.nuro.team systemd[1]: Started NetBox Request Queue Worker. Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: Traceback (most recent call last): Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/manage.py", line 10, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: execute_from_command_line(sys.argv) Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: utility.execute() Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 357, in execute Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: django.setup() Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/local/lib/python3.6/dist-packages/django/__init__.py", line 24, in setup Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: apps.populate(settings.INSTALLED_APPS) Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/local/lib/python3.6/dist-packages/django/apps/registry.py", line 114, in populate Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: app_config.import_models() Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/local/lib/python3.6/dist-packages/django/apps/config.py", line 211, in import_models Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: self.models_module = import_module(models_module_name) Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: return _bootstrap._gcd_import(name[level:], package, level) Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/circuits/models.py", line 8, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: from dcim.models import CableTermination Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/dcim/models/__init__.py", line 1, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: from .device_component_templates import * Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/dcim/models/device_component_templates.py", line 7, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: from extras.models import ObjectChange Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/extras/models/__init__.py", line 1, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: from .change_logging import ChangeLoggedModel, ObjectChange Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/extras/models/change_logging.py", line 48, in <module> Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: class ObjectChange(models.Model): Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: File "/opt/netbox/netbox/extras/models/change_logging.py", line 106, in ObjectChange Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: object_data = models.JSONField( Aug 22 22:13:08 netbox.corp.nuro.team python3[13335]: AttributeError: module 'django.db.models' has no attribute 'JSONField' Aug 22 22:13:08 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE Aug 22 22:13:08 netbox.corp.nuro.team systemd[1]: netbox-rq.service: Failed with result 'exit-code'. ``` I tried to put django-jsonfield==1.4.0 in requirements.txt, but still not work
adam closed this issue 2025-12-29 18:32:37 +01:00
Author
Owner

@LeSnowTiger commented on GitHub (Aug 24, 2020):

I had the same issue.
Manually running the following command worked for me:

pip3 install -r /opt/netbox/requirements.txt

@LeSnowTiger commented on GitHub (Aug 24, 2020): I had the same issue. Manually running the following command worked for me: `pip3 install -r /opt/netbox/requirements.txt`
Author
Owner

@jeremystretch commented on GitHub (Aug 24, 2020):

AttributeError: module 'django.db.models' has no attribute 'JSONField'

Your environment is not running the required version of Django. Please follow the documented upgrade procedure, and note any error in the output of the upgrade script. If you still have issues, please post to the mailing list for assistance.

@jeremystretch commented on GitHub (Aug 24, 2020): > `AttributeError: module 'django.db.models' has no attribute 'JSONField'` Your environment is not running the required version of Django. Please follow the [documented upgrade procedure](https://netbox.readthedocs.io/en/stable/installation/upgrading/), and note any error in the output of the upgrade script. If you still have issues, please post to the [mailing list](https://groups.google.com/forum/#!forum/netbox-discuss) for assistance.
Author
Owner

@mikeb93 commented on GitHub (Sep 24, 2020):

Hi,

I hate to dig up closed issues, but I'm having the same one.
No errors on upgrade script.
Django was updated to 3.1 as I could see in the script.

@s-fu did you ever find out what the issue was?

@mikeb93 commented on GitHub (Sep 24, 2020): Hi, I hate to dig up closed issues, but I'm having the same one. No errors on upgrade script. Django was updated to 3.1 as I could see in the script. @s-fu did you ever find out what the issue was?
Author
Owner

@jeremystretch commented on GitHub (Sep 24, 2020):

@mikeb93 please post to the mailing list for assistance.

@jeremystretch commented on GitHub (Sep 24, 2020): @mikeb93 please post to the mailing list for assistance.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4012