Facing these error while installing the bench

commad: sudo python install.py --production --user frappe

error:
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “new-site”, “site1.local”, “–admin-password”, “123456”, “–mariadb-root-password”, “123456”], “delta”: “0:00:01.226816”, “end”: “2018-07-10 11:59:09.396246”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2018-07-10 11:59:08.169430”, “stderr”: “Traceback (most recent call last):\n File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main\n "main", fname, loader, pkg_name)\n File "/usr/lib/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in \n main()\n File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main\n click.Group(commands=commands)(prog_name=‘bench’)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 722, in call\n return self.main(*args, **kwargs)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main\n rv = self.invoke(ctx)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke\n return ctx.invoke(self.callback, **ctx.params)\n File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke\n return callback(*args, **kwargs)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 34, in new_site\n verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 65, in _new_site\n admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 36, in install_db\n create_database_and_user(force, verbose)\n File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 64, in create_database_and_user\n raise Exception("Database %s already exists" % (db_name,))\nException: Database 1bd3e0294da19198 already exists”, “stderr_lines”: [“Traceback (most recent call last):”, " File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main", " "main", fname, loader, pkg_name)“, " File "/usr/lib/python2.7/runpy.py", line 72, in _run_code”, " exec code in run_globals", " File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in “, " 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/local/lib/python2.7/site-packages/click/core.py", line 722, in call”, " return self.main(*args, **kwargs)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 697, in main”, " rv = self.invoke(ctx)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke”, " return ctx.invoke(self.callback, **ctx.params)“, " File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke”, " return callback(*args, **kwargs)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 34, in new_site”, " verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 65, in _new_site”, " admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 36, in install_db”, " create_database_and_user(force, verbose)“, " File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 64, in create_database_and_user”, " raise Exception("Database %s already exists" % (db_name,))", “Exception: Database 1bd3e0294da19198 already exists”], “stdout”: “”, “stdout_lines”: []}
to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost : ok=77 changed=17 unreachable=0 failed=1

Traceback (most recent call last):
File “install.py”, line 417, in
install_bench(args)
File “install.py”, line 122, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 338, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2

cc: @Shubham_Gupta

/home/frappe/frappe-bench/
mysql -u root -p
mysql>
DROP DATABASE 1bd3e0294da19198
exit

sudo python install.py --production --user frappe

TASK [nodejs : Install nodejs 8] ***********************************************
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: "Failed to update apt cache: "}

OK not sure why node install failed… You could try

sudo apt-get update

cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodes
nodejs -v

You should see
v8.10.0

cd /home/frappe/frappe-bench/
sudo python install.py --production --user frappe

ki-linux@kilinux-ideacentre-300S-11ISH:/home/frappe/frappe-bench$ sudo python install.py --production --user frappe
python: can’t open file ‘install.py’: [Errno 2] No such file or directory

sorry
cd /home/frappe/

And if I do that in the root
the same error(first one) comes up again

commad: sudo python install.py --production --user frappe

error:
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “new-site”, “site1.local”, “–admin-password”, “123456”, “–mariadb-root-password”, “123456”], “delta”: “0:00:01.226816”, “end”: “2018-07-10 11:59:09.396246”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2018-07-10 11:59:08.169430”, “stderr”: “Traceback (most recent call last):\n File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main\n “main”, fname, loader, pkg_name)\n File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code\n exec code in run_globals\n File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in \n main()\n File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main\n click.Group(commands=commands)(prog_name=‘bench’)\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call\n return self.main(*args, **kwargs)\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main\n rv = self.invoke(ctx)\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke\n return _process_result(sub_ctx.command.invoke(sub_ctx))\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke\n return ctx.invoke(self.callback, **ctx.params)\n File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke\n return callback(*args, **kwargs)\n File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 34, in new_site\n verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)\n File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 65, in _new_site\n admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)\n File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 36, in install_db\n create_database_and_user(force, verbose)\n File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 64, in create_database_and_user\n raise Exception(“Database %s already exists” % (db_name,))\nException: Database 1bd3e0294da19198 already exists”, “stderr_lines”: [“Traceback (most recent call last):”, " File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main", " “main”, fname, loader, pkg_name)“, " File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code”, " exec code in run_globals", " File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in “, " 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/local/lib/python2.7/site-packages/click/core.py”, line 722, in call”, " return self.main(*args, **kwargs)“, " File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main”, " rv = self.invoke(ctx)“, " File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke”, " return _process_result(sub_ctx.command.invoke(sub_ctx))“, " File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke”, " return ctx.invoke(self.callback, **ctx.params)“, " File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke”, " return callback(*args, **kwargs)“, " File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 34, in new_site”, " verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)“, " File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 65, in _new_site”, " admin_password=admin_password, verbose=verbose, source_sql=source_sql,force=force, reinstall=reinstall)“, " File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 36, in install_db”, " create_database_and_user(force, verbose)“, " File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 64, in create_database_and_user”, " raise Exception(“Database %s already exists” % (db_name,))", “Exception: Database 1bd3e0294da19198 already exists”], “stdout”: “”, “stdout_lines”: []}
to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost : ok=77 changed=17 unreachable=0 failed=1

Traceback (most recent call last):
File “install.py”, line 417, in
install_bench(args)
File “install.py”, line 122, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 338, in run_playbook
success = subprocess.check_call(args, cwd=os.path.join(cwd, ‘playbooks’))
File “/usr/lib/python2.7/subprocess.py”, line 541, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-e’, ‘@/tmp/extra_vars.json’, ‘–become’, ‘–become-user=frappe’]’ returned non-zero exit status 2

Sorry I haven’t used this particular install method before… Looks like user frappe is already created and causing issues could you try
su frappe
sudo python install.py --production

how can i uninstall frappe and reinstall it
can u explain me the prodedure
sir

Are you currently logged in as root? If you don’t have a frappe user, sudo python install.py --production --user frappe will create the frappe user for you. But if you manually created frappe as the first user for your server, you only need to run sudo python install.py --production.

As for this one:

If the server can be reformatted, then do reformat it and do a clean install using either the easy install script or by doing a manual install. ( You can find both here: GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps )