No module named 'payments' Could not find app "payments"

i am using this apps.json file to make a custom image.

export APPS_JSON='[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "version-15-hotfix"
  },
  {
    "url": "https://github.com/frappe/health",
    "branch": "develop"
  },
  {
    "url": "https://github.com/frappe/payments",
    "branch": "version-15"
  }
]'
export APPS_JSON_BASE64=$(echo ${APPS_JSON} | base64 -w 0)

and im using the following command to make images

 sudo buildah build   --build-arg=FRAPPE_PATH=https://github.com/frappe/frappe   --build-arg=FRAPPE_BRANCH=version-15-hotfix   --build-arg=PYTHON_VERSION=3.11.6   --build-arg=NODE_VERSION=18.18.2   --build-arg=APPS_JSON_BASE64=$APPS_JSON_BASE64   --tag=ghcr.io/m5ingh/cstm-frappe:1.0.0   --file=images/custom/Containerfile .

however when this image is pulled in a k3s cluster, health app is installed and available in desk but not payments app.
while creating new site job before completion if i take a look at the logs i see this error

│ create-site                                                                                                                                                                                                                                                                                                                                                                            │
│ create-site Installing healthcare...                                                                                                                                                                                                                                                                                                                                                   │
│ create-site Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                         │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/caching.py", line 55, in wrapper                                                                                                                                                                                                                                                                                │
│ create-site     return frappe.local.request_cache[func][args_key]                                                                                                                                                                                                                                                                                                                      │
│ create-site            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^                                                                                                                                                                                                                                                                                                                      │
│ create-site KeyError: 4293052651069949659                                                                                                                                                                                                                                                                                                                                              │
│ create-site                                                                                                                                                                                                                                                                                                                                                                            │
│ create-site During handling of the above exception, another exception occurred:                                                                                                                                                                                                                                                                                                        │
│ create-site                                                                                                                                                                                                                                                                                                                                                                            │
│ create-site Traceback (most recent call last):                                                                                                                                                                                                                                                                                                                                         │
│ create-site   File "<frozen runpy>", line 198, in _run_module_as_main                                                                                                                                                                                                                                                                                                                  │
│ create-site   File "<frozen runpy>", line 88, in _run_code                                                                                                                                                                                                                                                                                                                             │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>                                                                                                                                                                                                                                                                         │
│ create-site     main()                                                                                                                                                                                                                                                                                                                                                                 │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main                                                                                                                                                                                                                                                                              │
│ create-site     click.Group(commands=commands)(prog_name="bench")                                                                                                                                                                                                                                                                                                                      │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__                                                                                                                                                                                                                                                                  │
│ create-site     return self.main(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                      │
│ create-site            ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                      │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1078, in main                                                                                                                                                                                                                                                                      │
│ create-site     rv = self.invoke(ctx)                                                                                                                                                                                                                                                                                                                                                  │
│ create-site          ^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                                  │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke                                                                                                                                                                                                                                                                    │
│ create-site     return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                                                                                                                                                                                │
│ create-site                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                 │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke                                                                                                                                                                                                                                                                    │
│ create-site     return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                                                                                                                                                                                                                                │
│ create-site                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                 │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke                                                                                                                                                                                                                                                                    │
│ create-site     return ctx.invoke(self.callback, **ctx.params)                                                                                                                                                                                                                                                                                                                         │
│ create-site            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                         │
│ create-site   File "/home/frappe/frappe-bench/env/lib/python3.11/site-packages/click/core.py", line 783, in invoke                                                                                                                                                                                                                                                                     │
│ create-site     return __callback(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                     │
│ create-site            ^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                     │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 76, in new_site                                                                                                                                                                                                                                                                               │
│ create-site     _new_site(                                                                                                                                                                                                                                                                                                                                                             │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 112, in _new_site                                                                                                                                                                                                                                                                                 │
│ create-site     install_app(app, verbose=verbose, set_as_patched=not source_sql, force=False)                                                                                                                                                                                                                                                                                          │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 266, in install_app                                                                                                                                                                                                                                                                               │
│ create-site     app_hooks = frappe.get_hooks(app_name=name)                                                                                                                                                                                                                                                                                                                            │
│ create-site                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                            │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1577, in get_hooks                                                                                                                                                                                                                                                                                 │
│ create-site     hooks = _dict(_load_app_hooks(app_name))                                                                                                                                                                                                                                                                                                                               │
│ create-site                   ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/caching.py", line 57, in wrapper                                                                                                                                                                                                                                                                                │
│ create-site     return_val = func(*args, **kwargs)                                                                                                                                                                                                                                                                                                                                     │
│ create-site                  ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                     │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1549, in _load_app_hooks                                                                                                                                                                                                                                                                           │
│ create-site     app_hooks = get_module(f"{app}.hooks")                                                                                                                                                                                                                                                                                                                                 │
│ create-site                 ^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                                 │
│ create-site   File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1415, in get_module                                                                                                                                                                                                                                                                                │
│ create-site     return importlib.import_module(modulename)                                                                                                                                                                                                                                                                                                                             │
│ create-site            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                                             │
│ create-site   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module                                                                                                                                                                                                                                                                                       │
│ create-site     return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                                                                                                                                                            │
│ create-site            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                                                                                            │
│ create-site   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import                                                                                                                                                                                                                                                                                                          │
│ create-site   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load                                                                                                                                                                                                                                                                                                       │
│ create-site   File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked                                                                                                                                                                                                                                                                                              │
│ create-site   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed                                                                                                                                                                                                                                                                                             │
│ create-site   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import                                                                                                                                                                                                                                                                                                          │
│ create-site   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load                                                                                                                                                                                                                                                                                                       │
│ create-site   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked                                                                                                                                                                                                                                                                                              │
│ create-site ModuleNotFoundError: No module named 'payments'                                                                                                                                                                                                                                                                                                                            │
│ create-site Updating DocTypes for healthcare    : [                                        ] 0%Updating DocTypes for healthcare    : [                                        ] 1%Updating DocTypes for healthcare    : [=                                       ] 2%Updating DocTypes for healthcare    : [=                                       ] 3%Updating DocTypes for healthca │
│ create-site Updating Dashboard for healthcare                                                                                                                                                                                                                                                                                                                                          │
│ create-site Could not find app "payments":                                                                                                                                                                                                                                                                                                                                             │
│ create-site No module named 'payments'

I have tried various versions and tried building with docker build too but same thing happens. Please guide me whats wrong with my setup.

you have 2 options:

1- bench update --reset
2- bench --site [your site] reinstall

Note: take a full backup before any action

bench get-app payments
bench --site install-app payments

You can’t use “bench get-app” in a container deployment. It needs to be put into the image at build time, as OP attempted to do in their APPS_JSON. There is probably an earlier build-time error (in the output from the “buildah build” command) that will indicate why the payments app is not available to be installed in the site.

thanks ben. do you have any pointers on what i can do to catch those build time errors as the output goes by very fast and is so long too.

Sure, you can add this to the end of your buildah build command. Which will send the entire output and any errors into a file, output.txt you could look through later:

1> output.txt 2>&1

thanks agin ben, the addition works perfectly. however i could not find anything relavant to my problem. this is the output file. can you please take a look.

Can you please do me a favour and build healthcare and payments in a custom image and tell me if its working on your end. I would really appreciate the help.

I actually don’t see erpnext OR payments OR health being built at all in your output file. It looks like all that’s being built is frappe, nothing else. That indicates something isn’t right in your APPS_JSON_BASE64 variable. Before you run your build command, try checking those variables to make sure they look right:

echo $APPS_JSON
echo $APPS_JSON_BASE64

Also, I see there is no version-15 branch for the health app yet. There is a version-15-beta, though. Seems like it’s not ready for version-15. You should try building an image for all your apps in version-14 first and see if you can get success with that. After you get a good result with that, see what’s possible with the version-15/develop apps.

So the problem was two fold:

  1. the image being made indeed didn’t have correct base64encoded values. To resolve that i did made sure that every previous build artifact was pruned and then in a new terminal first check
echo $APPS_JSON_BASE64

It should be empty. Now navigate to frappe_docker folder and create a new app.json like so

[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "version-15"
  },
  {
    "url": "https://github.com/frappe/health",
    "branch": "version-15-beta"
  },
  {
    "url": "https://github.com/frappe/payments",
    "branch": "version-15"
  }
]

then

export APPS_JSON_BASE64=$(base64 -w 0 apps.json)

then again verify with echo $APPS_JSON_BASE64 that values are correct. then only proceed to build and push.

  1. image.pullPolicy of helm chart was set to IfNotPresent. This effectively meant that if i was using the same tag and version in each build newer images were never pulled into the cluster. To resolve this either use a different registry, or use updated version or put some appropritate value for image.pullPolicy that always pulls image from registry. and remember to change this value back to IfNotPresent when ready for production.