Import Error from rq when trying to spin up a worker
It seems there is an issue when we try to spin up a worker. The following error occurs:
root@cb1fe159a166:/code# FLASK_APP=`pwd`/cre.py python cre.py --start_worker
Traceback (most recent call last):
File "/code/cre.py", line 244, in <module>
main()
File "/code/cre.py", line 240, in main
cre_main.run(args)
File "/code/application/cmd/cre_main.py", line 631, in run
from application.worker import start_worker
File "/code/application/worker.py", line 3, in <module>
from rq import Worker, Queue, Connection
ImportError: cannot import name 'Connection' from 'rq' (/usr/local/lib/python3.11/site-packages/rq/__init__.py)
We have validated that OpenCRE has a fully functioning Redis and OpenCRE is correctly configured to connect to it. We can after all see the jobs get queued in the respective redis keys.
hi @vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.
Steps Taken to Fix:
- Checked the installed rq version.
- Removed the deprecated Connection import.
- Used Redis for connection instead.
- Initialized the worker with the correct Redis connection.
- Tested and confirmed the worker is running successfully.
Next Steps:
Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!
Hey thank you for taking a look, yes please go ahead!
On Wed, 12 Mar 2025, 19:49 @., @.> wrote:
hi @vfxcode https://github.com/vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.
Steps Taken to Fix:
- Checked the installed rq version.
- Removed the deprecated Connection import.
- Used Redis for connection instead.
- Initialized the worker with the correct Redis connection.
- Tested and confirmed the worker is running successfully.
Next Steps:
Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!
— Reply to this email directly, view it on GitHub https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMCRHSHOMN7U3UCPZUA6E32UCFVVAVCNFSM6AAAAABXLLV7AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYHEZTMNRRGM . You are receiving this because you are subscribed to this thread.Message ID: @.***> [image: Hardik301002]Hardik301002 left a comment (OWASP/OpenCRE#582) https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613
hi @vfxcode https://github.com/vfxcode Issue: Getting ImportError: cannot import name 'Connection' from 'rq' when trying to spin up the worker.
Steps Taken to Fix:
- Checked the installed rq version.
- Removed the deprecated Connection import.
- Used Redis for connection instead.
- Initialized the worker with the correct Redis connection.
- Tested and confirmed the worker is running successfully.
Next Steps:
Should we update the dependencies or document this change to prevent future issues? Let me know your thoughts!
— Reply to this email directly, view it on GitHub https://github.com/OWASP/OpenCRE/issues/582#issuecomment-2718936613, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMCRHSHOMN7U3UCPZUA6E32UCFVVAVCNFSM6AAAAABXLLV7AKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJYHEZTMNRRGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>