No such file or directory: './config/supervisor.conf' error at bench directory

I’m trying my hand at the manual setup due to various issues with the easy installer, but I’m getting stuck at the sudo bench setup production frappe; Googling suggested I execute this at the bench directory but still no luck:

~/bench$ sudo bench setup production frappe
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/root/bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/bench/bench/commands/setup.py", line 67, in setup_production
    setup_production(user=user, yes=yes)
  File "/root/bench/bench/config/production_setup.py", line 15, in setup_production
    generate_supervisor_config(bench_path=bench_path, user=user, yes=yes)
  File "/root/bench/bench/config/supervisor.py", line 41, in generate_supervisor_config
    with open(conf_path, 'w') as f:
IOError: [Errno 2] No such file or directory: './config/supervisor.conf'

The install notes state that the bench and so on should be installed as a non root user account (for example frappe)

https://frappe.io/docs/user/en/bench/guides/manual-setup

That seems to be your problem here?

EDIT:

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/root/bench/bench/cli.py", line 40, in cli
    bench_command()

The above refers to /root/bench/bench/cli.py
but one should expect to see /home/frappe/.bench/bench/cli.py or other non-root user

@clarkej, if you follow the link at the bottom for the guide to set up production, it instructs you to run the exact sudo command I mentioned.

Agreed that setup fails. My guess is that’s because your bench install is the problem.

Since making this post, I’ve been thinking that it’s because I didn’t do bench init or make any sites before running this command, but I’ve run into issues running bench init itself, as I’ve detailed on newer topics.

Fine I’ll close this - your question is a common one if you would simply search and read!