Redis.Commands Module Missing after update to latest version of Frappe (14.5.0) and Erpnext (14.03)

After updating to the lastest version using “bench update --reset” there was an error during the update:

Here is the relevant error output:

[frappe@javier-pc ~]$ cd erpnext/
[frappe@javier-pc erpnext]$ ls
apps  archived  config  env  logs  patches.txt  Procfile  sites
[frappe@javier-pc erpnext]$ bench update --reset
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch            version-14 -> FETCH_HEAD
Backing up sites...
Backup Summary for speedsea.zapto.org at 2022-08-31 14:12:53.643483
Config  : ./speedsea.zapto.org/private/backups/20220831_141247-speedsea_zapto_org-site_config_backup.json 316.0B
Database: ./speedsea.zapto.org/private/backups/20220831_141247-speedsea_zapto_org-database.sql.gz         2.0MiB
Backup for Site speedsea.zapto.org has been successfully completed
Updating apps source...
$ git fetch --depth=1 --no-tags upstream version-14
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch            version-14 -> FETCH_HEAD
$ git reset --hard upstream/version-14
HEAD is now at a3af839 chore(release): Bumped to Version 14.5.0
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 4804, done.
Counting objects: 100% (4804/4804), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2793/2793), done.
Writing objects: 100% (4804/4804), done.
Total 4804 (delta 1894), reused 4804 (delta 1894), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream main
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/desk
 * branch            main       -> FETCH_HEAD
$ git reset --hard upstream/main
HEAD is now at e122e74 Merge pull request #690 from kamaljohnson/minor-fixes
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 736, done.
Counting objects: 100% (736/736), done.
Delta compression using up to 4 threads
Compressing objects: 100% (434/434), done.
Writing objects: 100% (736/736), done.
Total 736 (delta 274), reused 736 (delta 274), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/payments
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at 8637be4 Merge pull request #3 from phot0n/add-linter
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 84, done.
Counting objects: 100% (84/84), done.
Delta compression using up to 4 threads
Compressing objects: 100% (66/66), done.
Writing objects: 100% (84/84), done.
Total 84 (delta 12), reused 84 (delta 12), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at 30039e8 fix: encode thumbnail URL
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 5256, done.
Counting objects: 100% (5256/5256), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3687/3687), done.
Writing objects: 100% (5256/5256), done.
Total 5256 (delta 1339), reused 5256 (delta 1339), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/agriculture
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at e76ddb1 chore: Added GNU GPL V3 license to the app
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 125, done.
Counting objects: 100% (125/125), done.
Delta compression using up to 4 threads
Compressing objects: 100% (83/83), done.
Writing objects: 100% (125/125), done.
Total 125 (delta 36), reused 125 (delta 36), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/bench_manager
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at f728732 Merge pull request #74 from newhrorg/develop
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 95, done.
Counting objects: 100% (95/95), done.
Delta compression using up to 4 threads
Compressing objects: 100% (48/48), done.
Writing objects: 100% (95/95), done.
Total 95 (delta 34), reused 95 (delta 34), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream develop
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/hrms
 * branch            develop    -> FETCH_HEAD
$ git reset --hard upstream/develop
HEAD is now at d45e05c fix: job opening not set in application web form (#47)
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 1228, done.
Counting objects: 100% (1228/1228), done.
Delta compression using up to 4 threads
Compressing objects: 100% (809/809), done.
Writing objects: 100% (1228/1228), done.
Total 1228 (delta 345), reused 1228 (delta 345), pack-reused 0
$ find . -name "*.pyc" -delete
$ git fetch --depth=1 --no-tags upstream main
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/insights
 * branch            main       -> FETCH_HEAD
$ git reset --hard upstream/main
HEAD is now at d830337 chore: update README.md
$ git reflog expire --all
$ git gc --prune=all
Enumerating objects: 611, done.
Counting objects: 100% (611/611), done.
Delta compression using up to 4 threads
Compressing objects: 100% (306/306), done.
Writing objects: 100% (611/611), done.
Total 611 (delta 286), reused 611 (delta 286), pack-reused 0
$ find . -name "*.pyc" -delete
Setting up requirements...
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade pip
Installing 8 applications...
Installing frappe
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/frappe
$ yarn install
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 1.13s.
Installing frappedesk
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/frappedesk
$ yarn install
yarn install v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
success Already up-to-date.
$ cd desk && yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.70s.
Done in 1.46s.
Installing payments
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/payments
Installing erpnext
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/erpnext
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.27s.
Installing agriculture
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/agriculture
Installing bench_manager
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/bench_manager
Installing hrms
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/hrms
Installing insights
$ /home/frappe/erpnext/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/erpnext/apps/insights
$ yarn install
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
$ cd frontend && yarn install --ignore-engines
yarn install v1.22.19
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.59s.
Done in 2.34s.
Patching sites...
Migrating speedsea.zapto.org
Updating DocTypes for frappe        : [========================================] 100%
Updating DocTypes for payments      : [========================================] 100%
Updating DocTypes for erpnext       : [========================================] 100%
Updating DocTypes for hrms          : [========================================] 100%
Updating DocTypes for insights      : [========================================] 100%
erpnext.projects.doctype.project.project.project_status_update_reminder is not a valid method: No module named 'redis.commands'
erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings.automatic_synchronization is not a valid method: No module named 'redis.commands'
erpnext.projects.doctype.project.project.hourly_reminder is not a valid method: No module named 'redis.commands'
erpnext.projects.doctype.project.project.collect_project_status is not a valid method: No module named 'redis.commands'
erpnext.controllers.accounts_controller.update_invoice_status is not a valid method: No module named 'redis.commands'
erpnext.stock.doctype.serial_no.serial_no.update_maintenance_status is not a valid method: No module named 'redis.commands'
erpnext.assets.doctype.asset.asset.update_maintenance_status is not a valid method: No module named 'redis.commands'
erpnext.assets.doctype.asset.asset.make_post_gl_entry is not a valid method: No module named 'redis.commands'
erpnext.projects.doctype.project.project.update_project_sales_billing is not a valid method: No module named 'redis.commands'
erpnext.projects.doctype.project.project.send_project_status_email_to_users is not a valid method: No module named 'redis.commands'
erpnext.selling.doctype.quotation.quotation.set_expired_status is not a valid method: No module named 'redis.commands'
erpnext.buying.doctype.supplier_quotation.supplier_quotation.set_expired_status is not a valid method: No module named 'redis.commands'
erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_term_loans is not a valid method: No module named 'redis.commands'
erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual.process_loan_interest_accrual_for_demand_loans is not a valid method: No module named 'redis.commands'
Updating Dashboard for frappe
Updating Dashboard for payments
Updating Dashboard for erpnext
Updating Dashboard for hrms
Updating Dashboard for insights
Updating customizations for Address
Updating customizations for Contact
Building search index for speedsea.zapto.org
Retrieving Routes                   : [========================================] 100%
Building Index                      : [========================================] 100%
Building assets...
Assets for Commit a3af8397706216240a3656552d6a4e066d2c5d0a don't exist
✔ Application Assets Linked


yarn run v1.22.19
$ node esbuild --production --run-build-command

Compiling Python files...
________________________________________________________________________________
Bench: Deployment tool for Frappe and Frappe Applications (https://frappe.io/bench).
Open source depends on your contributions, so do give back by submitting bug reports, patches and fixes and be a part of the community :)
[frappe@javier-pc erpnext]$ sudo supervisorctl restart all
erpnext-redis:erpnext-redis-cache: stopped
erpnext-redis:erpnext-redis-socketio: stopped
erpnext-web:erpnext-node-socketio: stopped
erpnext-redis:erpnext-redis-queue: stopped
erpnext-workers:erpnext-frappe-schedule: stopped
erpnext-workers:erpnext-frappe-default-worker-0: stopped
erpnext-workers:erpnext-frappe-short-worker-0: stopped
erpnext-workers:erpnext-frappe-long-worker-0: stopped
erpnext-web:erpnext-frappe-web: stopped
erpnext-redis:erpnext-redis-cache: started
erpnext-redis:erpnext-redis-queue: started
erpnext-redis:erpnext-redis-socketio: started
erpnext-web:erpnext-frappe-web: started
erpnext-web:erpnext-node-socketio: started
erpnext-workers:erpnext-frappe-schedule: started
erpnext-workers:erpnext-frappe-default-worker-0: started
erpnext-workers:erpnext-frappe-short-worker-0: started
erpnext-workers:erpnext-frappe-long-worker-0: started

Afterwards, there main page of the site fails with “Internal Server Error” see the attached screenshot:

On the web.error.log the following errors appears:

ImportError: Module import failed for Item Group, the DocType you're trying to open might be deleted.<br> Error: No module named 'redis.commands'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/erpnext/env/lib/python3.10/site-packages/gunicorn/workers/sync.py", line 136, in handle
    self.handle_request(listener, req, client, addr)
  File "/home/frappe/erpnext/env/lib/python3.10/site-packages/gunicorn/workers/sync.py", line 179, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/frappe/erpnext/env/lib/python3.10/site-packages/werkzeug/local.py", line 196, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/home/frappe/erpnext/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py", line 187, in application
    resp = f(*args[:-2] + (request,))
  File "/home/frappe/erpnext/apps/frappe/frappe/app.py", line 90, in application
    response = handle_exception(e)
  File "/home/frappe/erpnext/apps/frappe/frappe/app.py", line 287, in handle_exception
    response = get_response("message", http_status_code=http_status_code)
  File "/home/frappe/erpnext/apps/frappe/frappe/website/serve.py", line 27, in get_response
    response = ErrorPage(exception=e).render()
  File "/home/frappe/erpnext/apps/frappe/frappe/website/page_renderers/template_page.py", line 78, in render
    html = self.get_html()
  File "/home/frappe/erpnext/apps/frappe/frappe/website/utils.py", line 510, in cache_html_decorator
    html = func(*args, **kwargs)
  File "/home/frappe/erpnext/apps/frappe/frappe/website/page_renderers/template_page.py", line 93, in get_html
    self.post_process_context()
  File "/home/frappe/erpnext/apps/frappe/frappe/website/page_renderers/template_page.py", line 103, in post_process_context
    super().post_process_context()
  File "/home/frappe/erpnext/apps/frappe/frappe/website/page_renderers/base_template_page.py", line 32, in post_process_context
    self.update_website_context()
  File "/home/frappe/erpnext/apps/frappe/frappe/website/page_renderers/base_template_page.py", line 73, in update_website_context
    values = frappe.get_attr(method)(self.context)
  File "/home/frappe/erpnext/apps/frappe/frappe/__init__.py", line 1589, in get_attr
    return getattr(get_module(modulename), methodname)
  File "/home/frappe/erpnext/apps/frappe/frappe/__init__.py", line 1337, in get_module
    return importlib.import_module(modulename)
  File "/usr/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 "/home/frappe/erpnext/apps/erpnext/erpnext/e_commerce/shopping_cart/utils.py", line 5, in <module>
    from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import is_cart_enabled
  File "/home/frappe/erpnext/apps/erpnext/erpnext/e_commerce/doctype/e_commerce_settings/e_commerce_settings.py", line 10, in <module>
    from erpnext.e_commerce.redisearch_utils import (
  File "/home/frappe/erpnext/apps/erpnext/erpnext/e_commerce/redisearch_utils.py", line 10, in <module>
    from redis.commands.search.field import TagField, TextField
ModuleNotFoundError: No module named 'redis.commands'

Is there a way to fix this error?

Best,

Javier

I have the same issue on a fresh setup, did you get this sorted somehow?

You mixed develop and v14 branches somehow. Looks like your ERPNext is on develop branch.

Redis is upgraded on develop branch.

ref:

1 Like

Thanks. Using bench init --skip-redis-config-generation --frappe-branch develop frappe-bench AND bench get-app --branch develop erpnext fixed the issue for me when using the container development environment.

2 Likes

Not slove in my case, i have created new bench frappe-bench-develop and installed payroll and erpnext getting error while in this two apps that is

sagar_p@pvipl-ThinkPad-E450:~/frappe-bench-develop$ bench get-app payments
A directory for the application 'payments' already exists. Do you want to continue and overwrite it? [y/N]: y
INFO: App moved from apps/payments to archived/apps/payments-2022-11-15
Getting payments
$ git clone https://github.com/frappe/payments.git --branch develop --depth 1 --origin upstream
Cloning into 'payments'...
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 84 (delta 12), reused 37 (delta 4), pack-reused 0
Unpacking objects: 100% (84/84), 41.21 KiB | 1.79 MiB/s, done.
Ignoring dependencies of payments. To install dependencies use --resolve-deps
Installing payments
$ /home/sagar_p/frappe-bench-develop/env/bin/python -m pip install --quiet --upgrade -e /home/sagar_p/frappe-bench-develop/apps/payments 
$ bench build --app payments
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/sagar_p/frappe-bench-develop/apps/frappe/frappe/utils/bench_helper.py", line 104, in <module>
    main()
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/utils/bench_helper.py", line 19, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sagar_p/frappe-bench-develop/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/commands/utils.py", line 58, in build
    frappe.init("")
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/__init__.py", line 248, in init
    setup_module_map()
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/__init__.py", line 1501, in setup_module_map
    _cache = cache()
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/__init__.py", line 362, in cache
    from frappe.utils.redis_wrapper import RedisWrapper
  File "/home/sagar_p/frappe-bench-develop/apps/frappe/frappe/utils/redis_wrapper.py", line 7, in <module>
    from redis.commands.search import Search
ModuleNotFoundError: No module named 'redis.commands'
ERROR: 
Traceback (most recent call last):
  File "/home/sagar_p/.local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/commands/make.py", line 159, in get_app
    get_app(
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/app.py", line 444, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/app.py", line 242, in install
    install_app(
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/app.py", line 586, in install_app
    build_assets(bench_path=bench_path, app=app)
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 330, in build_assets
    exec_cmd(command, cwd=bench_path, env={"BENCH_DEVELOPER": "1"})
  File "/home/sagar_p/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 155, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

facing the same error,

I started on a clean setup and included version-14 while installing both frappe-bench and erpnext. there seems to be some inconsistency for vscode devcontainer setup.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.