Apps.txt not found

I am facing below error

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    commands = get_app_groups()
               ^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 27, in get_app_groups
    for app in get_apps():
               ^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 107, in get_apps
    return frappe.get_all_apps(with_internal_apps=False, sites_path=".")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1481, in get_all_apps
    apps = get_file_items(os.path.join(sites_path, "apps.txt"), raise_not_found=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1628, in get_file_items
    content = read_file(path, raise_not_found=raise_not_found)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1656, in read_file
    raise OSError(f"{path} Not Found")
OSError: b'./apps.txt' Not Found

I am using helm version : 7.0.0 to deploy on cluster
It was working fine few days back, i have encoutred site not found error when accessing the webpage and I did a rollback via Helm and now facing above error

Go to :

[YOUR_BENCH]/sites

and check apps.txt is exist or not.

You can also run below command :

bench setup requirements

I have checked sites directory and not able to find apps.txt
then i executed
bench setup requirements

got below error

 ls 
apps  config  env  logs  patches.txt  sites
frappe@frappe-bench-erpnext-gunicorn-c8d8d5b99-4vgf8:~/frappe-bench$ cd sites/
frappe@frappe-bench-erpnext-gunicorn-c8d8d5b99-4vgf8:~/frappe-bench/sites$ ls
assets
frappe@frappe-bench-erpnext-gunicorn-c8d8d5b99-4vgf8:~/frappe-bench/sites$ bench setup requirements
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Installing 2 applications...
ERROR: /home/frappe/frappe-bench/apps/frappe
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/cli.py", line 132, in cli
    bench_command()
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/commands/setup.py", line 228, in setup_requirements
    bench.setup.requirements(apps=apps)
  File "/usr/local/lib/python3.11/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/bench.py", line 464, in requirements
    app = App(path_to_app, bench=self.bench, to_clone=False).install(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 176, in __init__
    super().__init__(name, branch, *args, **kwargs)
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 77, in __init__
    self.setup_details()
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 93, in setup_details
    self._setup_details_from_mounted_disk()
  File "/usr/local/lib/python3.11/site-packages/bench/app.py", line 111, in _setup_details_from_mounted_disk
    self.git_repo = git.Repo(self.mount_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/git/repo/base.py", line 267, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: /home/frappe/frappe-bench/apps/frappe
INFO: A newer version of bench is available: 5.19.0 → 5.22.3

Reinstall Frappe and Erpnext App. And Reinstall with get-app command

can you pls tell me what commands i have to use , if any link which guide this process can also work

First you create apps.txt :page_facing_up: manually in [YOUR_BENCH]/sites.

apps.txt content :

frappe
erpnext

and reinstall app in site.

IF ABOVE SUGGESTION DOESN’T WORK FOLLOW BELOW STEPS

If you have no previous data then you can make other bench, and frappe app will be installed by default.

Command :

bench init --python python3.11 --version <VERSION_NAME> <FOLDER_NAME>

(Note: version are branch name, if you not specify it is by default develop )


Then Get erpnext app :

bench get-app --branch <BRANCH_NAME> erpnext

(Note: Both Frappe and Erpnext must have same version, by default it is develop)


Create new site

bench new-site <SITE_NAME>.localhost
bench use <SITE_NAME>.localhost

Install ErpNext

bench install-app erpnext

Do not execute this in container. All requirements are already packed in container.

You can create apps.txt with ls and pipe,

Or re run the configure bench job.

Make sure sites volume is accessible by frappe user in container. Uid:gid 1000:1000

Search container basics and container builds on this forum to know about containers.

cherrycharan hope you have solved this problem, am also facing this problem, i will appreciate if you could help

You can create apps.txt with ls and pipe,

@Abdulahi you can do the above, this solved my problem and in my case there has been issue with NFS storage