Description of the issue
I cannot install any other app than erpnext, when install app like payments, non_profit it shows internal server error in browser and ModuleNotFoundError: No module named ‘app_name’ error in backend logs
Context information (for bug reports)
Steps to reproduce the issue
- install frappe docker in docker swarm with erpnext with the below stack
version: "3.7"
services:
backend:
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
configurator:
command:
- |
ls -1 apps > sites/apps.txt; bench set-config -g db_host $$DB_HOST; bench set-config -gp db_port $$DB_PORT; bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_socketio "redis://$$REDIS_SOCKETIO"; bench set-config -gp socketio_port $$SOCKETIO_PORT;
deploy:
restart_policy:
condition: none
placement:
constraints:
- node.labels.client == xxxxxxx
entrypoint:
- bash
- -c
environment:
DB_HOST: db
DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379
REDIS_SOCKETIO: redis-socketio:6379
SOCKETIO_PORT: "9000"
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
db:
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed
environment:
MYSQL_ROOT_PASSWORD: "admin"
healthcheck:
test:
- CMD-SHELL
- mysqladmin ping -h localhost --password=admin
interval: 1s
retries: 15
image: mariadb:10.6
networks:
default: null
volumes:
- type: volume
source: db-data
target: /var/lib/mysql
volume: {}
frontend:
command:
- nginx-entrypoint.sh
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
labels:
traefik.enable: "true"
traefik.http.routers.xxxxxxx.entrypoints: 'https'
traefik.docker.network: 'door'
traefik.http.routers.xxxxxxx.rule: 'Host(`xxxxxxx.in`)'
traefik.http.routers.xxxxxxx.tls.certresolver: 'letsencrypt'
traefik.http.services.xxxxxxx.loadbalancer.server.port: "8080"
environment:
BACKEND: backend:8000
CLIENT_MAX_BODY_SIZE: 50m
FRAPPE_SITE_NAME_HEADER: $$host
PROXY_READ_TIMOUT: "120"
SOCKETIO: websocket:9000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
image: frappe/erpnext:v14.41.2
networks:
default: null
door: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
queue-default:
command:
- bench
- worker
- --queue
- default
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
queue-long:
command:
- bench
- worker
- --queue
- long
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
queue-short:
command:
- bench
- worker
- --queue
- short
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
redis-cache:
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-cache-data
target: /data
volume: {}
redis-queue:
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-queue-data
target: /data
volume: {}
redis-socketio:
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-socketio-data
target: /data
volume: {}
scheduler:
command:
- bench
- schedule
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
websocket:
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
networks:
default: null
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
- type: volume
source: logs
target: /home/frappe/frappe-bench/logs
volume: {}
- type: volume
source: apps
target: /home/frappe/frappe-bench/apps
volume: {}
- type: volume
source: assets
target: /home/frappe/frappe-bench/sites/assets
volume: {}
networks:
default:
name: xxxxxxx
door:
name: door
external: true
volumes:
db-data:
name: xxxxxxx_db-data
redis-cache-data:
name: xxxxxxx_redis-cache-data
redis-queue-data:
name: xxxxxxx_redis-queue-data
redis-socketio-data:
name: xxxxxxx_redis-socketio-data
sites:
name: xxxxxxx_sites
logs:
name: xxxxxxx_logs
apps:
name: xxxxxxx_apps
assets:
name: xxxxxxx_assets
x-backend-defaults:
deploy:
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
volumes:
- sites:/home/frappe/frappe-bench/sites
x-customizable-image:
deploy:
placement:
constraints:
- node.labels.client == xxxxxxx
image: frappe/erpnext:v14.41.2
x-depends-on-configurator:
deploy:
placement:
constraints:
- node.labels.client == xxxxxxx
3.install erpnext via bench cmd in backend service(container)
4.the site works fine till this
5.install a app via bench cmd in backend service(container) eg: payments, non_profit, india_compliance
6.check if sites/apps.txt is updated and it is updated
Expected result
1.the site should work as normal without any error
Observed result
1.Internal Server Error in browser
2. ModuleNotFoundError: No module named ‘app_name’ in backend service logs
Stacktrace / full error message if available
- error when run bench version in backend service
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
main()
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name="bench")
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/frappe/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/frappe/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/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 1093, in get_version
frappe.init("")
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 252, in init
setup_module_map()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1553, in setup_module_map
for module in get_module_list(app):
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1393, in get_module_list
return get_file_items(os.path.join(os.path.dirname(get_module(app_name).__file__), "modules.txt"))
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1342, in get_module
return importlib.import_module(modulename)
File "/usr/local/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'
- error in backend service logs
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py", line 26, in set_file_path
file_path = frappe.get_app_path(app, "www") + "/" + self.path
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1371, in get_app_path
return get_pymodule_path(app_name, *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1388, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1342, in get_module
return importlib.import_module(modulename)
File "/usr/local/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 104, in application
response = get_response()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 26, in get_response
response = ErrorPage(exception=e).render()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/error_page.py", line 7, in __init__
super().__init__(path=path, http_status_code=http_status_code)
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 45, in __init__
self.set_template_path()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 54, in set_template_path
app_path = frappe.get_app_path(app)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1371, in get_app_path
return get_pymodule_path(app_name, *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1388, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1342, in get_module
return importlib.import_module(modulename)
File "/usr/local/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 17, in get_response
endpoint, renderer_instance = path_resolver.resolve()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/path_resolver.py", line 58, in resolve
renderer_instance = renderer(endpoint, 200)
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py", line 19, in __init__
self.set_file_path()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py", line 26, in set_file_path
file_path = frappe.get_app_path(app, "www") + "/" + self.path
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1371, in get_app_path
return get_pymodule_path(app_name, *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1388, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1342, in get_module
return importlib.import_module(modulename)
File "/usr/local/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 271, in handle
keepalive = self.handle_request(req, conn)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
respiter = self.wsgi(environ, resp.start_response)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/werkzeug/local.py", line 237, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py", line 194, in application
resp = f(*args[:-2] + (request,))
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 113, in application
response = handle_exception(e)
File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 367, in handle_exception
response = get_response("message", http_status_code=http_status_code)
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/serve.py", line 26, in get_response
response = ErrorPage(exception=e).render()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/error_page.py", line 7, in __init__
super().__init__(path=path, http_status_code=http_status_code)
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 45, in __init__
self.set_template_path()
File "/home/frappe/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py", line 54, in set_template_path
app_path = frappe.get_app_path(app)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1371, in get_app_path
return get_pymodule_path(app_name, *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1388, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).__file__ or ""), *joins)
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1342, in get_module
return importlib.import_module(modulename)
File "/usr/local/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 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'payments'