Redis Error 111 connecting to localhost:13000

I am installing it in local oracle virtual box. When I run command

bench --site x2.llc.in install-app hrms

I get error with following messages on terminal :

App payments already installed
App erpnext already installed

Installing hrms...
Updating DocTypes for hrms          : [========================================] 100%

Patching Existing Data...
An error occurred while installing hrms: Error 111 connecting to localhost:13000. Connection refused.
Traceback (most recent call last):
  File "env/lib/python3.10/site-packages/redis/connection.py", line 559, in connect
    sock = self._connect()
  File "env/lib/python3.10/site-packages/redis/connection.py", line 615, in _connect
    raise err
  File "env/lib/python3.10/site-packages/redis/connection.py", line 603, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 413, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/installer.py", line 304, in install_app
    frappe.get_attr(after_install)()

Is redis-server installed and running? what does bench setup redis return?

ok just
bench --site [sitename] uninstall-app hrms
then
bench --site [sitename] install-app hrms

try it

It returns as follows:

erpnext@erpnextvm:~$ sudo systemctl status redis.service
[sudo] password for erpnext:
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
     Active: active (running) since Tue 2022-11-29 12:13:18 IST; 12min ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 724 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 4625)
     Memory: 5.4M
        CPU: 1.017s
     CGroup: /system.slice/redis-server.service
             └─724 "/usr/bin/redis-server 127.0.0.1:6379" "" "" "" "" "" "" "" >

Nov 29 12:13:18 erpnextvm systemd[1]: Starting Advanced key-value store...
Nov 29 12:13:18 erpnextvm systemd[1]: Started Advanced key-value store.
lines 1-15/15 (END)

when I uninstall, i get following in terminal

erpnext@erpnextvm:~/frappe-bench$ bench --site x2.llc.in uninstall-app hrms
Uninstalling App hrms from Site x2.llc.in...
All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue? [y/N]: y
Backing up...
Deleting Module 'HR'
* removing DocType 'Leave Block List'...
* removing DocType 'HR Settings'...
* removing DocType 'Grievance Type'...
* removing DocType 'Designation Skill'...
* removing DocType 'Leave Type'...
* removing DocType 'Employee Grade'...
* removing DocType 'Training Feedback'...
* removing DocType 'Training Event'...
* removing DocType 'Employee Promotion'...
* removing DocType 'Leave Allocation'...
* removing DocType 'Skill'...
* removing DocType 'Employee Boarding Activity'...
* removing DocType 'Employee Onboarding'...
* removing DocType 'Leave Policy'...
* removing DocType 'Training Result'...
* removing DocType 'Appointment Letter'...
* removing DocType 'Appointment Letter Template'...
* removing DocType 'Travel Request'...
* removing DocType 'Leave Encashment'...
* removing DocType 'Employee Advance'...
* removing DocType 'Leave Policy Assignment'...
* removing DocType 'Leave Period'...
* removing DocType 'Job Applicant'...
* removing DocType 'Exit Interview'...
* removing DocType 'Expense Claim Detail'...
* removing DocType 'Expense Claim Advance'...
* removing DocType 'Expense Claim'...
* removing DocType 'Expense Taxes and Charges'...
* removing DocType 'Interview Feedback'...
* removing DocType 'Interview'...
* removing DocType 'Interview Round'...
* removing DocType 'Interview Type'...
* removing DocType 'Interview Detail'...
* removing DocType 'Full and Final Statement'...
* removing DocType 'Employee Separation'...
* removing DocType 'Full and Final Outstanding Statement'...
* removing DocType 'Full and Final Asset'...
* removing DocType 'Training Event Employee'...
* removing DocType 'Employee Grievance'...
* removing DocType 'Vehicle Log'...
* removing DocType 'Employee Referral'...
* removing DocType 'Interviewer'...
* removing DocType 'Skill Assessment'...
* removing DocType 'Expected Skill Set'...
* removing DocType 'Leave Ledger Entry'...
* removing DocType 'Appraisal'...
* removing DocType 'Attendance'...
* removing DocType 'Appraisal Goal'...
* removing DocType 'Upload Attendance'...
* removing DocType 'Appraisal Template'...
* removing DocType 'Expense Claim Type'...
* removing DocType 'Appraisal Template Goal'...
* removing DocType 'Job Opening'...
* removing DocType 'Shift Request'...
* removing DocType 'Employee Checkin'...
* removing DocType 'Job Offer'...
* removing DocType 'Shift Assignment'...
* removing DocType 'Leave Application'...
* removing DocType 'Vehicle Service'...
* removing DocType 'Appointment Letter content'...
* removing DocType 'Attendance Request'...
* removing DocType 'Employee Skill Map'...
* removing DocType 'Leave Control Panel'...
* removing DocType 'Shift Type'...
* removing DocType 'Staffing Plan Detail'...
* removing DocType 'Employee Training'...
* removing DocType 'Employee Skill'...
* removing DocType 'Training Result Employee'...
* removing DocType 'Employment Type'...
* removing DocType 'Employee Separation Template'...
* removing DocType 'Employee Onboarding Template'...
* removing DocType 'Employee Transfer'...
* removing DocType 'Compensatory Leave Request'...
* removing DocType 'Job Applicant Source'...
* removing DocType 'Staffing Plan'...
* removing DocType 'Daily Work Summary Group User'...
* removing DocType 'Identification Document Type'...
* removing DocType 'Travel Request Costing'...
* removing DocType 'Travel Itinerary'...
* removing DocType 'Purpose of Travel'...
* removing DocType 'Employee Property History'...
* removing DocType 'Department Approver'...
* removing DocType 'Employee Health Insurance'...
* removing DocType 'Leave Policy Detail'...
* removing DocType 'Daily Work Summary'...
* removing DocType 'Daily Work Summary Group'...
* removing DocType 'Job Offer Term'...
* removing DocType 'Training Program'...
* removing DocType 'Interest'...
* removing DocType 'Offer Term'...
* removing DocType 'Expense Claim Account'...
* removing DocType 'Leave Block List Date'...
* removing DocType 'Leave Block List Allow'...
* removing DocType 'Employee Attendance Tool'...
* removing Workspace 'Expense Claims'...
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 559, in connect
    sock = self._connect()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 615, in _connect
    raise err
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 603, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 333, in get_redis_conn
    redis_connection = RedisQueue.get_connection(**cred)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/redis_queue.py", line 24, in get_connection
    conn.ping()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 1378, in ping
    return self.execute_command('PING')
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 898, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 1192, in get_connection
    connection.connect()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
    main()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 798, in uninstall
    remove_app(app_name=app, dry_run=dry_run, yes=yes, no_backup=no_backup, force=force)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 375, in remove_app
    drop_doctypes = _delete_modules(modules, dry_run=dry_run)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 413, in _delete_modules
    _delete_linked_documents(module_name, doctype_link_field_map, dry_run=dry_run)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 431, in _delete_linked_documents
    frappe.delete_doc(doctype, record, ignore_on_trash=True, force=True)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 1235, in delete_doc
    return frappe.model.delete_doc.delete_doc(
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/delete_doc.py", line 146, in delete_doc
    frappe.enqueue(
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 2144, in enqueue
    return frappe.utils.background_jobs.enqueue(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 90, in enqueue
    q = get_queue(queue, is_async=is_async)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 295, in get_queue
    return Queue(generate_qname(qtype), connection=get_redis_conn(), is_async=is_async)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 361, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7f2c9c3b1330 state=finished raised ConnectionError>]
erpnext@erpnextvm:~/frappe-bench$ 

Following is the settings in my /etc/redis/redis.conf file

bind 127.0.0.1 ::1
port 6379

Now, when i update this port to 13000, and check status, I see following result:

erpnext@erpnextvm:~/frappe-bench$ sudo systemctl status redis.service
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
     Active: active (running) since Tue 2022-11-29 17:59:49 IST; 5s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 18711 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 4625)
     Memory: 2.8M
        CPU: 134ms
     CGroup: /system.slice/redis-server.service
             └─18711 "/usr/bin/redis-server 127.0.0.1:13000" "" "" "" "" "" "" >

Nov 29 17:59:49 erpnextvm systemd[1]: Starting Advanced key-value store...
Nov 29 17:59:49 erpnextvm systemd[1]: Started Advanced key-value store.

erpnext@erpnextvm:~/frappe-bench$ 

I am not sure, what exactly is the impact of that error Redis Error 111 connecting to localhost:13000

And after changing the port to 13000, will this problem be solved. After updating port to 13000, when I try to uninstall hrms app, i get following error on terminal:

erpnext@erpnextvm:~/frappe-bench$ bench --site x2.llc.in uninstall-app hrms
Uninstalling App hrms from Site x2.llc.in...
All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue? [y/N]: y
Backing up...
Deleting Module 'HR'
* removing DocType 'Leave Block List'...
* removing DocType 'HR Settings'...
* removing DocType 'Grievance Type'...
* removing DocType 'Designation Skill'...
* removing DocType 'Leave Type'...
* removing DocType 'Employee Grade'...
* removing DocType 'Training Feedback'...
* removing DocType 'Training Event'...
* removing DocType 'Employee Promotion'...
* removing DocType 'Leave Allocation'...
* removing DocType 'Skill'...
* removing DocType 'Employee Boarding Activity'...
* removing DocType 'Employee Onboarding'...
* removing DocType 'Leave Policy'...
* removing DocType 'Training Result'...
* removing DocType 'Appointment Letter'...
* removing DocType 'Appointment Letter Template'...
* removing DocType 'Travel Request'...
* removing DocType 'Leave Encashment'...
* removing DocType 'Employee Advance'...
* removing DocType 'Leave Policy Assignment'...
* removing DocType 'Leave Period'...
* removing DocType 'Job Applicant'...
* removing DocType 'Exit Interview'...
* removing DocType 'Expense Claim Detail'...
* removing DocType 'Expense Claim Advance'...
* removing DocType 'Expense Claim'...
* removing DocType 'Expense Taxes and Charges'...
* removing DocType 'Interview Feedback'...
* removing DocType 'Interview'...
* removing DocType 'Interview Round'...
* removing DocType 'Interview Type'...
* removing DocType 'Interview Detail'...
* removing DocType 'Full and Final Statement'...
* removing DocType 'Employee Separation'...
* removing DocType 'Full and Final Outstanding Statement'...
* removing DocType 'Full and Final Asset'...
* removing DocType 'Training Event Employee'...
* removing DocType 'Employee Grievance'...
* removing DocType 'Vehicle Log'...
* removing DocType 'Employee Referral'...
* removing DocType 'Interviewer'...
* removing DocType 'Skill Assessment'...
* removing DocType 'Expected Skill Set'...
* removing DocType 'Leave Ledger Entry'...
* removing DocType 'Appraisal'...
* removing DocType 'Attendance'...
* removing DocType 'Appraisal Goal'...
* removing DocType 'Upload Attendance'...
* removing DocType 'Appraisal Template'...
* removing DocType 'Expense Claim Type'...
* removing DocType 'Appraisal Template Goal'...
* removing DocType 'Job Opening'...
* removing DocType 'Shift Request'...
* removing DocType 'Employee Checkin'...
* removing DocType 'Job Offer'...
* removing DocType 'Shift Assignment'...
* removing DocType 'Leave Application'...
* removing DocType 'Vehicle Service'...
* removing DocType 'Appointment Letter content'...
* removing DocType 'Attendance Request'...
* removing DocType 'Employee Skill Map'...
* removing DocType 'Leave Control Panel'...
* removing DocType 'Shift Type'...
* removing DocType 'Staffing Plan Detail'...
* removing DocType 'Employee Training'...
* removing DocType 'Employee Skill'...
* removing DocType 'Training Result Employee'...
* removing DocType 'Employment Type'...
* removing DocType 'Employee Separation Template'...
* removing DocType 'Employee Onboarding Template'...
* removing DocType 'Employee Transfer'...
* removing DocType 'Compensatory Leave Request'...
* removing DocType 'Job Applicant Source'...
* removing DocType 'Staffing Plan'...
* removing DocType 'Daily Work Summary Group User'...
* removing DocType 'Identification Document Type'...
* removing DocType 'Travel Request Costing'...
* removing DocType 'Travel Itinerary'...
* removing DocType 'Purpose of Travel'...
* removing DocType 'Employee Property History'...
* removing DocType 'Department Approver'...
* removing DocType 'Employee Health Insurance'...
* removing DocType 'Leave Policy Detail'...
* removing DocType 'Daily Work Summary'...
* removing DocType 'Daily Work Summary Group'...
* removing DocType 'Job Offer Term'...
* removing DocType 'Training Program'...
* removing DocType 'Interest'...
* removing DocType 'Offer Term'...
* removing DocType 'Expense Claim Account'...
* removing DocType 'Leave Block List Date'...
* removing DocType 'Leave Block List Allow'...
* removing DocType 'Employee Attendance Tool'...
* removing Workspace 'Expense Claims'...
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Please make sure that Redis Queue runs @ redis://localhost:11000
Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 559, in connect
    sock = self._connect()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 615, in _connect
    raise err
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 603, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 407, in __call__
    result = fn(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 333, in get_redis_conn
    redis_connection = RedisQueue.get_connection(**cred)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/redis_queue.py", line 24, in get_connection
    conn.ping()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 1378, in ping
    return self.execute_command('PING')
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/client.py", line 898, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 1192, in get_connection
    connection.connect()
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/redis/connection.py", line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11000. Connection refused.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
    main()
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 798, in uninstall
    remove_app(app_name=app, dry_run=dry_run, yes=yes, no_backup=no_backup, force=force)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 375, in remove_app
    drop_doctypes = _delete_modules(modules, dry_run=dry_run)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 413, in _delete_modules
    _delete_linked_documents(module_name, doctype_link_field_map, dry_run=dry_run)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 431, in _delete_linked_documents
    frappe.delete_doc(doctype, record, ignore_on_trash=True, force=True)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 1235, in delete_doc
    return frappe.model.delete_doc.delete_doc(
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/delete_doc.py", line 146, in delete_doc
    frappe.enqueue(
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 2144, in enqueue
    return frappe.utils.background_jobs.enqueue(*args, **kwargs)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 90, in enqueue
    q = get_queue(queue, is_async=is_async)
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 295, in get_queue
    return Queue(generate_qname(qtype), connection=get_redis_conn(), is_async=is_async)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 324, in wrapped_f
    return self(f, *args, **kw)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 404, in __call__
    do = self.iter(retry_state=retry_state)
  File "/home/erpnext/frappe-bench/env/lib/python3.10/site-packages/tenacity/__init__.py", line 361, in iter
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x7ff0a8accc10 state=finished raised ConnectionError>]
erpnext@erpnextvm:~/frappe-bench$ 

I don’t think you want to change the redis port. Are there other sites that are running apps without problems?

Look at: sudo systemctl status supervisor and , try bench setup supervisor and bench setup socketio

Sorry, it didn’t work.

I reattempted to install hrms and ran the commands that you mentioned in my backed up VM that is staged just before installing hrms. Following is the result:

erpnext@erpnextvm:~$ cd frappe-bench
erpnext@erpnextvm:~/frappe-bench$ sudo systemctl status supervisor
[sudo] password for erpnext: 
● supervisor.service - Supervisor process control system for UNIX
     Loaded: loaded (/lib/systemd/system/supervisor.service; enabled; vendor pr>
     Active: active (running) since Tue 2022-11-29 22:23:04 IST; 33min ago
       Docs: http://supervisord.org
   Main PID: 724 (supervisord)
      Tasks: 1 (limit: 4625)
     Memory: 23.7M
        CPU: 835ms
     CGroup: /system.slice/supervisor.service
             └─724 /usr/bin/python3 /usr/bin/supervisord -n -c /etc/supervisor/>

Nov 29 22:23:04 erpnextvm systemd[1]: Started Supervisor process control system>
Nov 29 22:23:06 erpnextvm supervisord[724]: 2022-11-29 22:23:06,145 CRIT Superv>
Nov 29 22:23:06 erpnextvm supervisord[724]: 2022-11-29 22:23:06,150 WARN No fil>
Nov 29 22:23:06 erpnextvm supervisord[724]: 2022-11-29 22:23:06,192 INFO RPC in>
Nov 29 22:23:06 erpnextvm supervisord[724]: 2022-11-29 22:23:06,193 CRIT Server>
Nov 29 22:23:06 erpnextvm supervisord[724]: 2022-11-29 22:23:06,193 INFO superv>
lines 1-17/17 (END)
erpnext@erpnextvm:~/frappe-bench$ bench setup supervisor 
INFO: A newer version of bench is available: 5.14.4 β†’ 5.15.1
erpnext@erpnextvm:~/frappe-bench$ bench setup socketio
INFO: A newer version of bench is available: 5.14.4 β†’ 5.15.1
erpnext@erpnextvm:~/frappe-bench$ pip3 install --upgrade frappe-bench
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: frappe-bench in /usr/local/lib/python3.10/dist-packages (5.14.4)
Collecting frappe-bench
  Downloading frappe_bench-5.15.1-py3-none-any.whl (145 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.0/145.0 KB 522.0 kB/s eta 0:00:00
Requirement already satisfied: python-crontab~=2.6.0 in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (2.6.0)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from frappe-bench) (2.25.1)
Requirement already satisfied: click>=7.0 in /usr/lib/python3/dist-packages (from frappe-bench) (8.0.3)
Requirement already satisfied: jinja2~=3.0.3 in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (3.0.3)
Requirement already satisfied: tomli in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (2.0.1)
Requirement already satisfied: honcho in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (1.1.0)
Requirement already satisfied: setuptools>40.9.0 in /usr/lib/python3/dist-packages (from frappe-bench) (59.6.0)
Requirement already satisfied: gitpython~=2.1.15 in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (2.1.15)
Requirement already satisfied: semantic-version~=2.8.2 in /usr/local/lib/python3.10/dist-packages (from frappe-bench) (2.8.5)
Requirement already satisfied: gitdb2<3,>=2 in /usr/local/lib/python3.10/dist-packages (from gitpython~=2.1.15->frappe-bench) (2.0.6)
Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2~=3.0.3->frappe-bench) (2.1.1)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from python-crontab~=2.6.0->frappe-bench) (2.8.1)
Requirement already satisfied: smmap2>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from gitdb2<3,>=2->gitpython~=2.1.15->frappe-bench) (3.0.1)
Requirement already satisfied: smmap>=3.0.1 in /usr/local/lib/python3.10/dist-packages (from smmap2>=2.0.0->gitdb2<3,>=2->gitpython~=2.1.15->frappe-bench) (5.0.0)
Installing collected packages: frappe-bench
  WARNING: The script bench is installed in '/home/erpnext/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed frappe-bench-5.15.1
erpnext@erpnextvm:~/frappe-bench$ bench setup supervisor 
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y
erpnext@erpnextvm:~/frappe-bench$ bench setup socketio
erpnext@erpnextvm:~/frappe-bench$ service supervisor restart
erpnext@erpnextvm:~/frappe-bench$ bench --site x2.llc.in install-app hrms
App payments already installed
App erpnext already installed

Installing hrms...
Updating DocTypes for hrms          : [====================] 100%

Patching Existing Data...
An error occurred while installing hrms: Error 111 connecting to localhost:13000. Connection refused.
Traceback (most recent call last):
  File "env/lib/python3.10/site-packages/redis/connection.py", line 559, in connect
    sock = self._connect()
  File "env/lib/python3.10/site-packages/redis/connection.py", line 615, in _connect
    raise err
  File "env/lib/python3.10/site-packages/redis/connection.py", line 603, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 413, in install_app
    _install_app(app, verbose=context.verbose, force=force)
  File "apps/frappe/frappe/installer.py", line 304, in install_app
    frappe.get_attr(after_install)()
  File "apps/hrms/hrms/setup.py", line 22, in after_install
    run_post_install_patches()
  File "apps/hrms/hrms/setup.py", line 657, in run_post_install_patches
    frappe.get_attr(f"hrms.patches.post_install.{patch_name}.execute")()
  File "apps/hrms/hrms/patches/post_install/rename_stop_to_send_birthday_reminders.py", line 10, in execute
    rename_field("HR Settings", "stop_birthday_reminders", "send_birthday_reminders")
  File "apps/frappe/frappe/model/utils/rename_field.py", line 55, in rename_field
    update_user_settings(doctype, old_fieldname, new_fieldname)
  File "apps/frappe/frappe/model/utils/rename_field.py", line 166, in update_user_settings
    sync_user_settings()
  File "apps/frappe/frappe/model/utils/user_settings.py", line 49, in sync_user_settings
    for key, data in frappe.cache().hgetall("_user_settings").items():
  File "apps/frappe/frappe/utils/redis_wrapper.py", line 177, in hgetall
    value = super().hgetall(self.make_key(name))
  File "env/lib/python3.10/site-packages/redis/client.py", line 3014, in hgetall
    return self.execute_command('HGETALL', name)
  File "env/lib/python3.10/site-packages/redis/client.py", line 898, in execute_command
    conn = self.connection or pool.get_connection(command_name, **options)
  File "env/lib/python3.10/site-packages/redis/connection.py", line 1192, in get_connection
    connection.connect()
  File "env/lib/python3.10/site-packages/redis/connection.py", line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:13000. Connection refused.

erpnext@erpnextvm:~/frappe-bench$ 


Ok. I think I could solve this problem as follows.
There are two options. If there are multiple applications using your redis server, then edit the file /home/erpnext/frappe-bench/sites/common_site_config.json and update redis port from 13000 to 6379 or to whatever port number your redis server is running. Save file and proceed to install hrms.

Note I did not test above option because i did as mentioned below.

In my case I am using a VM which is used solely for ERPNext.
Before one runs the command **bench --site x2.llc.in install-app hrms**, to install hrms app, edit the redis configuration file

So i edited redis.conf
sudo nano /etc/redis/redis.conf

update port number to 13000. comment original port 6379

#port 6379
port 13000

Save file and restart redis. Now install hrms app.

Following is my terminal command and result snapshot

erpnext@erpnextvm:~$ sudo nano /etc/redis/redis.conf
erpnext@erpnextvm:~$ sudo supervisorctl reload
Restarted supervisord
erpnext@erpnextvm:~$ sudo service redis restart
erpnext@erpnextvm:~$ sudo service redis status
● redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor >
     Active: active (running) since Wed 2022-11-30 13:54:18 IST; 8s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
   Main PID: 5340 (redis-server)
     Status: "Ready to accept connections"
      Tasks: 5 (limit: 4625)
     Memory: 2.6M
        CPU: 104ms
     CGroup: /system.slice/redis-server.service
             └─5340 "/usr/bin/redis-server 127.0.0.1:13000" "" "" "" "" "" "" ">

Nov 30 13:54:18 erpnextvm systemd[1]: Starting Advanced key-value store...
Nov 30 13:54:18 erpnextvm systemd[1]: Started Advanced key-value store.
lines 1-15/15 (END)
erpnext@erpnextvm:~$ cd frappe-bench
erpnext@erpnextvm:~/frappe-bench$ sudo bench --site x2.llc.in install-app hrms
App payments already installed
App erpnext already installed

Installing hrms...
Updating DocTypes for hrms          : [====================] 100%

Patching Existing Data...
Thank you for installing Frappe HR!
Updating Dashboard for hrms
erpnext@erpnextvm:~/frappe-bench$

As you can see, now the hrms gets installed without any port error.

6 Likes

this works perfectly fine for me thanks.

Thanks ! this works. :innocent: