Bench installation error in production version

Hi,
While installing bench through easy install, I am getting stuck up at this stage. What should I do?

TASK [bench : install bench] ******************************************************************************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “cmd”: “/usr/local/bin/pip2 install -e /home/frappe/.bench”, “msg”: “stdout: Obtaining file:///home/frappe/.bench\nRequirement already satisfied: Click in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (6.7)\nRequirement already satisfied: jinja2 in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (2.10)\nRequirement already satisfied: virtualenv in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (15.2.0)\nRequirement already satisfied: requests in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (2.18.4)\nRequirement already satisfied: honcho in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (1.0.1)\nRequirement already satisfied: psutil in /usr/local/lib/python2.7/dist-packages (from bench==4.1.0) (5.4.5)\nRequirement already satisfied: python-crontab in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (2.2.8)\nRequirement already satisfied: semantic_version in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (2.6.0)\nRequirement already satisfied: GitPython==0.3.2.1 in /home/raghu/.local/lib/python2.7/site-packages (from bench==4.1.0) (0.3.2.1)\nRequirement already satisfied: MarkupSafe>=0.23 in /home/raghu/.local/lib/python2.7/site-packages (from jinja2->bench==4.1.0) (1.0)\nRequirement already satisfied: certifi>=2017.4.17 in /home/raghu/.local/lib/python2.7/site-packages (from requests->bench==4.1.0) (2018.1.18)\nRequirement already satisfied: chardet<3.1.0,>=3.0.2 in /home/raghu/.local/lib/python2.7/site-packages (from requests->bench==4.1.0) (3.0.4)\nRequirement already satisfied: idna<2.7,>=2.5 in /home/raghu/.local/lib/python2.7/site-packages (from requests->bench==4.1.0) (2.6)\nRequirement already satisfied: urllib3<1.23,>=1.21.1 in /home/raghu/.local/lib/python2.7/site-packages (from requests->bench==4.1.0) (1.22)\nRequirement already satisfied: python-dateutil in /home/raghu/.local/lib/python2.7/site-packages (from python-crontab->bench==4.1.0) (2.7.2)\nRequirement already satisfied: gitdb>=0.6.0 in /home/raghu/.local/lib/python2.7/site-packages (from GitPython==0.3.2.1->bench==4.1.0) (0.6.4)\nRequirement already satisfied: six>=1.5 in /home/raghu/.local/lib/python2.7/site-packages (from python-dateutil->python-crontab->bench==4.1.0) (1.11.0)\nRequirement already satisfied: smmap>=0.8.5 in /home/raghu/.local/lib/python2.7/site-packages (from gitdb>=0.6.0->GitPython==0.3.2.1->bench==4.1.0) (0.9.0)\nInstalling collected packages: bench\n Found existing installation: bench 4.1.0\n\n:stderr: The directory ‘/home/raghu/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.\nThe directory ‘/home/raghu/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.\nException:\nTraceback (most recent call last):\n File "/usr/local/lib/python2.7/dist-packages/pip/_internal/basecommand.py", line 228, in main\n status = self.run(options, args)\n File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/install.py", line 335, in run\n use_user_site=options.use_user_site,\n File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/init.py", line 42, in install_given_reqs\n auto_confirm=True\n File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_install.py", line 660, in uninstall\n uninstalled_pathset = UninstallPathSet.from_dist(dist)\n File "/usr/local/lib/python2.7/dist-packages/pip/_internal/req/req_uninstall.py", line 364, in from_dist\n ‘(at %s)’ % (link_pointer, dist.project_name, dist.location)\nAssertionError: Egg-link /home/raghu/bench-repo does not match installed location of bench (at /home/frappe/.bench)\n”}
to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP ************************************************************************************************************************************
localhost : ok=68 changed=13 unreachable=0 failed=1

Traceback (most recent call last):
File “install.py”, line 396, in
install_bench(args)
File “install.py”, line 113, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 329, 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

"
The directory ‘/home/raghu/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag
"

Hi there’s this permission issue, two suggestions -

If this is not a fresh install, just delete your frappe-bench and bench-repo folders and remove the “frappe” user

Also the recommended way to install and run ERPNext is from a non-root user account (such as frappe) that has been assigned sudo privileges.

Thanks @clarkej.
I tried with a fresh installation, now its working fine…