In-short, psutil python module is required for Bench is missing.
Error Log:
Traceback (most recent call last):
File "/usr/local/bin/bench", line 9, in <module>
load_entry_point('bench', 'console_scripts', 'bench')()
File "/home/frappe/.bench/bench/cli.py", line 40, in cli
bench_command()
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/frappe/.bench/bench/commands/setup.py", line 84, in setup_letsencrypt
setup_letsencrypt(site, bench_path='.')
File "/home/frappe/.bench/bench/config/lets_encrypt.py", line 25, in setup_letsencrypt
run_certbot_and_setup_ssl(site, bench_path)
File "/home/frappe/.bench/bench/config/lets_encrypt.py", line 55, in run_certbot_and_setup_ssl
make_nginx_conf(bench_path)
File "/home/frappe/.bench/bench/config/nginx.py", line 26, in make_nginx_conf
"limit_conn_shared_memory": get_limit_conn_shared_memory(),
File "/home/frappe/.bench/bench/config/nginx.py", line 167, in get_limit_conn_shared_memory
import psutil
ImportError: No module named psutil
Solution 1:
$ su - frappe
# Assuming you are logged in as frappe or equivalent user who have access to Bench / Frappe / ERPNext
$ cd frappe-bench/
$ source env/bin/activate
$ pip install --upgrade psutil
Note: If above does not solves your issue, then do following to fix it:
Solution 2:
# Assuming you are logged in as root or equivalent user who have access to sudo
$ sudo pip install --upgrade psutil