Skip to content

Netbox considers Python 3.10 to be an invalid Python version (lower than 3.7) #7752

@marcus-crane

Description

@marcus-crane

NetBox version

v3.0.9

Python version

3.10

Steps to Reproduce

Running python manage.py runserver using Python 3.10 causes the version check to fail.

This can be confirmed by running a little experiment in the REPL:

> python
Python 3.10.0 (default, Oct 30 2021, 17:17:08) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.python_version_tuple()
('3', '10', '0')
>>> platform.python_version_tuple() > ('3', '7')
False

I don't entirely understand why this is the case but either way, I would propose the following alternative:

> python                                                                                                              11:13pm / 0 / 1
Python 3.10.0 (default, Oct 30 2021, 17:17:08) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=10, micro=0, releaselevel='final', serial=0)
>>> sys.version_info > (3, 7)
True

I've got a branch locally that corrects this but as I recall, an issue is required to be approved before any PRs will be accepted so let me know and I'll happily submit a fix.

Expected Behavior

Netbox should run normally using Python 3.10

Observed Behavior

> (venv)  python manage.py runserver 
Traceback (most recent call last):
  File "/Users/marcus/Code/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/marcus/Code/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/Users/marcus/Code/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 363, in execute
    settings.INSTALLED_APPS
  File "/Users/marcus/Code/netbox/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/Users/marcus/Code/netbox/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/marcus/Code/netbox/venv/lib/python3.10/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/Users/marcus/.asdf/installs/python/3.10.0/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/marcus/Code/netbox/netbox/netbox/settings.py", line 29, in <module>
    raise RuntimeError(
RuntimeError: NetBox requires Python 3.7 or higher (current: Python 3.10.0)

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions