Netbox 3.5.0 upgrade results in failed netbox-rq service - ImportError: cannot import name 'use_connection' from 'rq' #7974

Closed
opened 2025-12-29 20:30:39 +01:00 by adam · 6 comments
Owner

Originally created by @PackeTsar on GitHub (May 1, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.5.0

Python version

3.8

Steps to Reproduce

  1. Install Netbox 3.5.0
  2. Make sure you've installed rq==1.14.0, which installs as an automatic dependency of django-rq==2.7.0
  3. Try to start the netbox-rq service

Expected Behavior

Service should start and work without issue

Observed Behavior

Service fails with:

May 01 16:09:02 NETBOX systemd[1]: Started NetBox Request Queue Worker.
May 01 16:09:02 NETBOX gunicorn[739]: [2023-05-01 16:09:02 +0000] [739] [INFO] Worker exiting (pid: 739)
May 01 16:09:02 NETBOX gunicorn[731]: [2023-05-01 16:09:02 +0000] [731] [INFO] Worker exiting (pid: 731)
May 01 16:09:02 NETBOX gunicorn[735]: [2023-05-01 16:09:02 +0000] [735] [INFO] Worker exiting (pid: 735)
May 01 16:09:03 NETBOX gunicorn[733]: [2023-05-01 16:09:03 +0000] [733] [INFO] Worker exiting (pid: 733)
May 01 16:09:03 NETBOX gunicorn[734]: [2023-05-01 16:09:03 +0000] [734] [INFO] Worker exiting (pid: 734)
May 01 16:09:04 NETBOX python[1529]: Traceback (most recent call last):
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/netbox/manage.py", line 10, in <module>
May 01 16:09:04 NETBOX python[1529]:     execute_from_command_line(sys.argv)
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
May 01 16:09:04 NETBOX python[1529]:     utility.execute()
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute
May 01 16:09:04 NETBOX python[1529]:     self.fetch_command(subcommand).run_from_argv(self.argv)
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 279, in fetch_command
May 01 16:09:04 NETBOX python[1529]:     klass = load_command_class(app_name, subcommand)
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 48, in load_command_class
May 01 16:09:04 NETBOX python[1529]:     module = import_module("%s.management.commands.%s" % (app_name, name))
May 01 16:09:04 NETBOX python[1529]:   File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
May 01 16:09:04 NETBOX python[1529]:     return _bootstrap._gcd_import(name[level:], package, level)
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap_external>", line 848, in exec_module
May 01 16:09:04 NETBOX python[1529]:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox-3.5.0/netbox/core/management/commands/rqworker.py", line 3, in <module>
May 01 16:09:04 NETBOX python[1529]:     from django_rq.management.commands.rqworker import Command as _Command
May 01 16:09:04 NETBOX python[1529]:   File "/opt/netbox/venv/lib/python3.8/site-packages/django_rq/management/commands/rqworker.py", line 5, in <module>
May 01 16:09:04 NETBOX python[1529]:     from rq import use_connection
May 01 16:09:04 NETBOX python[1529]: ImportError: cannot import name 'use_connection' from 'rq' (/opt/netbox/venv/lib/python3.8/site-packages/rq/__init__.py)
May 01 16:09:05 NETBOX systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE
May 01 16:09:05 NETBOX systemd[1]: netbox-rq.service: Failed with result 'exit-code'.
Originally created by @PackeTsar on GitHub (May 1, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.5.0 ### Python version 3.8 ### Steps to Reproduce 1. Install Netbox 3.5.0 2. Make sure you've installed `rq==1.14.0`, which installs as an automatic dependency of `django-rq==2.7.0` 3. Try to start the `netbox-rq` service ### Expected Behavior Service should start and work without issue ### Observed Behavior Service fails with: ``` May 01 16:09:02 NETBOX systemd[1]: Started NetBox Request Queue Worker. May 01 16:09:02 NETBOX gunicorn[739]: [2023-05-01 16:09:02 +0000] [739] [INFO] Worker exiting (pid: 739) May 01 16:09:02 NETBOX gunicorn[731]: [2023-05-01 16:09:02 +0000] [731] [INFO] Worker exiting (pid: 731) May 01 16:09:02 NETBOX gunicorn[735]: [2023-05-01 16:09:02 +0000] [735] [INFO] Worker exiting (pid: 735) May 01 16:09:03 NETBOX gunicorn[733]: [2023-05-01 16:09:03 +0000] [733] [INFO] Worker exiting (pid: 733) May 01 16:09:03 NETBOX gunicorn[734]: [2023-05-01 16:09:03 +0000] [734] [INFO] Worker exiting (pid: 734) May 01 16:09:04 NETBOX python[1529]: Traceback (most recent call last): May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/netbox/manage.py", line 10, in <module> May 01 16:09:04 NETBOX python[1529]: execute_from_command_line(sys.argv) May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line May 01 16:09:04 NETBOX python[1529]: utility.execute() May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 440, in execute May 01 16:09:04 NETBOX python[1529]: self.fetch_command(subcommand).run_from_argv(self.argv) May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 279, in fetch_command May 01 16:09:04 NETBOX python[1529]: klass = load_command_class(app_name, subcommand) May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 48, in load_command_class May 01 16:09:04 NETBOX python[1529]: module = import_module("%s.management.commands.%s" % (app_name, name)) May 01 16:09:04 NETBOX python[1529]: File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module May 01 16:09:04 NETBOX python[1529]: return _bootstrap._gcd_import(name[level:], package, level) May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap_external>", line 848, in exec_module May 01 16:09:04 NETBOX python[1529]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox-3.5.0/netbox/core/management/commands/rqworker.py", line 3, in <module> May 01 16:09:04 NETBOX python[1529]: from django_rq.management.commands.rqworker import Command as _Command May 01 16:09:04 NETBOX python[1529]: File "/opt/netbox/venv/lib/python3.8/site-packages/django_rq/management/commands/rqworker.py", line 5, in <module> May 01 16:09:04 NETBOX python[1529]: from rq import use_connection May 01 16:09:04 NETBOX python[1529]: ImportError: cannot import name 'use_connection' from 'rq' (/opt/netbox/venv/lib/python3.8/site-packages/rq/__init__.py) May 01 16:09:05 NETBOX systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE May 01 16:09:05 NETBOX systemd[1]: netbox-rq.service: Failed with result 'exit-code'. ```
adam added the type: bugstatus: under review labels 2025-12-29 20:30:39 +01:00
adam closed this issue 2025-12-29 20:30:39 +01:00
Author
Owner

@PackeTsar commented on GitHub (May 1, 2023):

FYI - This issue is not related to Netbox directly, but is an issue with one of its dependencies. I'm opening this ticket to help others who have a problem when updating to 3.5.0.

This looks to be an issue between the rq and django-rq libraries. This django-rq issue is related: https://github.com/rq/django-rq/issues/589

Looks like django-rq tries to import the deprecated and removed function use_connection from the rq library.

I was able to fix it on my own Netbox instance with the below commands.

sudo -i
cd /opt/netbox
source venv/bin/activate
pip3 uninstall rq
pip3 install  "rq==1.13.0"
systemctl restart netbox netbox-rq
@PackeTsar commented on GitHub (May 1, 2023): **FYI - This issue is not related to Netbox directly, but is an issue with one of its dependencies. I'm opening this ticket to help others who have a problem when updating to 3.5.0.** This looks to be an issue between the `rq` and `django-rq` libraries. This `django-rq` issue is related: https://github.com/rq/django-rq/issues/589 Looks like `django-rq` tries to import the deprecated and removed function `use_connection` from the `rq` library. I was able to fix it on my own Netbox instance with the below commands. ``` sudo -i cd /opt/netbox source venv/bin/activate pip3 uninstall rq pip3 install "rq==1.13.0" systemctl restart netbox netbox-rq ```
Author
Owner

@jeremystretch commented on GitHub (May 1, 2023):

Thanks for chasing this down @PackeTsar.

As this results from a discrepancy between two upstream packages, certain NetBox versions prior to v3.5 are affected as well.

@jeremystretch commented on GitHub (May 1, 2023): Thanks for chasing this down @PackeTsar. As this results from a discrepancy between two upstream packages, certain NetBox versions prior to v3.5 are affected as well.
Author
Owner

@jeremystretch commented on GitHub (May 1, 2023):

Given that adapting django-rq to work with the newest rq release will likely take some time (use_connection() has been removed entirely), we should probably pin to rq v1.13 for now to provide an immediate fix for NetBox.

@jeremystretch commented on GitHub (May 1, 2023): Given that adapting django-rq to work with the newest rq release will likely take some time (`use_connection()` has been removed entirely), we should probably pin to rq v1.13 for now to provide an immediate fix for NetBox.
Author
Owner

@mlazzarotto commented on GitHub (May 2, 2023):

Should I expect to have the same problem on netbox-docker instance as well?

@mlazzarotto commented on GitHub (May 2, 2023): Should I expect to have the same problem on [netbox-docker](https://github.com/netbox-community/netbox-docker) instance as well?
Author
Owner

@FliesLikeABrick commented on GitHub (May 17, 2023):

I have opened the issue mentioned above in netbox-docker because as @mlazzarotto mentions, we did run into this issue with netbox-docker as well

@FliesLikeABrick commented on GitHub (May 17, 2023): I have opened the issue mentioned above in netbox-docker because as @mlazzarotto mentions, we did run into this issue with netbox-docker as well
Author
Owner

@josefelipeduarte commented on GitHub (Jul 24, 2023):

Works for me
`FYI - This issue is not related to Netbox directly, but is an issue with one of its dependencies. I'm opening this ticket to help others who have a problem when updating to 3.5.0.

This looks to be an issue between the rq and django-rq libraries. This django-rq issue is related: https://github.com/rq/django-rq/issues/589

Looks like django-rq tries to import the deprecated and removed function use_connection from the rq library.

I was able to fix it on my own Netbox instance with the below commands.

sudo -i
cd /opt/netbox
source venv/bin/activate
pip3 uninstall rq
pip3 install "rq==1.13.0"
systemctl restart netbox netbox-rq`

@josefelipeduarte commented on GitHub (Jul 24, 2023): Works for me `FYI - This issue is not related to Netbox directly, but is an issue with one of its dependencies. I'm opening this ticket to help others who have a problem when updating to 3.5.0. This looks to be an issue between the rq and django-rq libraries. This django-rq issue is related: https://github.com/rq/django-rq/issues/589 Looks like django-rq tries to import the deprecated and removed function use_connection from the rq library. I was able to fix it on my own Netbox instance with the below commands. sudo -i cd /opt/netbox source venv/bin/activate pip3 uninstall rq pip3 install "rq==1.13.0" systemctl restart netbox netbox-rq`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7974