Bench get-app erpnext failing due to ContextualVersionConflict

Easy install.py failed with this error:

TASK [bench : Get the ERPNext app] *********************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "get-app", "erpnext", "https://github.com/frappe/erpnext", "--branch", "master"], "delta": "0:08:29.190887", "end": "2018-03-25 15:40:02.815480", "failed": true, "msg": "non-zero return code", "rc": 1, "start": "2018-03-25 15:31:33.624593", "stderr": "INFO:bench.app:getting app erpnext\nINFO:bench.utils:git clone https://github.com/frappe/erpnext --branch master --depth 1 --origin upstream\nCloning into 'erpnext'...\nChecking out files:  17% (1107/6329)   \rChecking out files:  18% (1140/6329)   \rChecking out files:  19% (1203/6329)   \rChecking out files:  19% (1216/6329)   \rChecking out files:  20% (1266/6329)   \rChecking out files:  20% (1328/6329)   \rChecking out files:  21% (1330/6329)   \rChecking out files:  22% (1393/6329)   \rChecking out files:  22% (1446/6329)   \rChecking out files:  23% (1456/6329)   \rChecking out files:  24% (1519/6329)   \rChecking out files:  24% (1520/6329)   \rChecking out files:  24% (1580/6329)   \rChecking out files:  25% (1583/6329)   \rChecking out files:  26% (1646/6329)   \rChecking out files:  26% (1672/6329)   \rChecking out files:  27% (1709/6329)   \rChecking out files:  28% (1773/6329)   \rChecking out files:  29% (1836/6329)   \rChecking out files:  29% (1838/6329)   \rChecking out files:  29% (1884/6329)   \rChecking out files:  29% (1897/6329)   \rChecking out files:  30% (1899/6329)   \rChecking out files:  31% (1962/6329)   \rChecking out files:  32% (2026/6329)   \rChecking out files:  32% (2041/6329)   \rChecking out files:  33% (2089/6329)   \rChecking out files:  34% (2152/6329)   \rChecking out files:  34% (2192/6329)   \rChecking out files:  35% (2216/6329)   \rChecking out files:  36% (2279/6329)   \rChecking out files:  37% (2342/6329)   \rChecking out files:  38% (2406/6329)   \rChecking out files:  39% (2469/6329)   \rChecking out files:  40% (2532/6329)   \rChecking out files:  41% (2595/6329)   \rChecking out files:  42% (2659/6329)   \rChecking out files:  43% (2722/6329)   \rChecking out files:  44% (2785/6329)   \rChecking out files:  45% (2849/6329)   \rChecking out files:  46% (2912/6329)   \rChecking out files:  47% (2975/6329)   \rChecking out files:  48% (3038/6329)   \rChecking out files:  49% (3102/6329)   \rChecking out files:  50% (3165/6329)   \rChecking out files:  51% (3228/6329)   \rChecking out files:  52% (3292/6329)   \rChecking out files:  53% (3355/6329)   \rChecking out files:  54% (3418/6329)   \rChecking out files:  55% (3481/6329)   \rChecking out files:  56% (3545/6329)   \rChecking out files:  57% (3608/6329)   \rChecking out files:  58% (3671/6329)   \rChecking out files:  59% (3735/6329)   \rChecking out files:  60% (3798/6329)   \rChecking out files:  61% (3861/6329)   \rChecking out files:  62% (3924/6329)   \rChecking out files:  63% (3988/6329)   \rChecking out files:  64% (4051/6329)   \rChecking out files:  65% (4114/6329)   \rChecking out files:  66% (4178/6329)   \rChecking out files:  67% (4241/6329)   \rChecking out files:  68% (4304/6329)   \rChecking out files:  69% (4368/6329)   \rChecking out files:  70% (4431/6329)   \rChecking out files:  71% (4494/6329)   \rChecking out files:  72% (4557/6329)   \rChecking out files:  73% (4621/6329)   \rChecking out files:  74% (4684/6329)   \rChecking out files:  75% (4747/6329)   \rChecking out files:  76% (4811/6329)   \rChecking out files:  77% (4874/6329)   \rChecking out files:  78% (4937/6329)   \rChecking out files:  79% (5000/6329)   \rChecking out files:  79% (5054/6329)   \rChecking out files:  80% (5064/6329)   \rChecking out files:  81% (5127/6329)   \rChecking out files:  82% (5190/6329)   \rChecking out files:  83% (5254/6329)   \rChecking out files:  84% (5317/6329)   \rChecking out files:  85% (5380/6329)   \rChecking out files:  86% (5443/6329)   \rChecking out files:  87% (5507/6329)   \rChecking out files:  88% (5570/6329)   \rChecking out files:  89% (5633/6329)   \rChecking out files:  90% (5697/6329)   \rChecking out files:  91% (5760/6329)   \rChecking out files:  92% (5823/6329)   \rChecking out files:  93% (5886/6329)   \rChecking out files:  94% (5950/6329)   \rChecking out files:  95% (6013/6329)   \rChecking out files:  96% (6076/6329)   \rChecking out files:  97% (6140/6329)   \rChecking out files:  98% (6203/6329)   \rChecking out files:  98% (6244/6329)   \rChecking out files:  98% (6252/6329)   \rChecking out files:  99% (6266/6329)   \rChecking out files:  99% (6282/6329)   \rChecking out files:  99% (6328/6329)   \rChecking out files: 100% (6329/6329)   \rChecking out files: 100% (6329/6329), done.\nINFO:bench.app:installing erpnext\nINFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext --no-cache-dir\nTraceback (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 <module>\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/utils.py\", line 20, in build\n    frappe.build.bundle(no_compress, make_copy=make_copy, restore = restore, verbose=verbose)\n  File \"/home/frappe/frappe-bench/apps/frappe/frappe/build.py\", line 40, in bundle\n    subprocess.call(command.split(' '))\n  File \"/usr/lib/python2.7/subprocess.py\", line 523, in call\n    return Popen(*popenargs, **kwargs).wait()\n  File \"/usr/lib/python2.7/subprocess.py\", line 711, in __init__\n    errread, errwrite)\n  File \"/usr/lib/python2.7/subprocess.py\", line 1343, in _execute_child\n    raise child_exception\nOSError: [Errno 2] No such file or directory", "stderr_lines": ["INFO:bench.app:getting app erpnext", "INFO:bench.utils:git clone https://github.com/frappe/erpnext --branch master --depth 1 --origin upstream", "Cloning into 'erpnext'...", "Checking out files:  17% (1107/6329)   ", "Checking out files:  18% (1140/6329)   ", "Checking out files:  19% (1203/6329)   ", "Checking out files:  19% (1216/6329)   ", "Checking out files:  20% (1266/6329)   ", "Checking out files:  20% (1328/6329)   ", "Checking out files:  21% (1330/6329)   ", "Checking out files:  22% (1393/6329)   ", "Checking out files:  22% (1446/6329)   ", "Checking out files:  23% (1456/6329)   ", "Checking out files:  24% (1519/6329)   ", "Checking out files:  24% (1520/6329)   ", "Checking out files:  24% (1580/6329)   ", "Checking out files:  25% (1583/6329)   ", "Checking out files:  26% (1646/6329)   ", "Checking out files:  26% (1672/6329)   ", "Checking out files:  27% (1709/6329)   ", "Checking out files:  28% (1773/6329)   ", "Checking out files:  29% (1836/6329)   ", "Checking out files:  29% (1838/6329)   ", "Checking out files:  29% (1884/6329)   ", "Checking out files:  29% (1897/6329)   ", "Checking out files:  30% (1899/6329)   ", "Checking out files:  31% (1962/6329)   ", "Checking out files:  32% (2026/6329)   ", "Checking out files:  32% (2041/6329)   ", "Checking out files:  33% (2089/6329)   ", "Checking out files:  34% (2152/6329)   ", "Checking out files:  34% (2192/6329)   ", "Checking out files:  35% (2216/6329)   ", "Checking out files:  36% (2279/6329)   ", "Checking out files:  37% (2342/6329)   ", "Checking out files:  38% (2406/6329)   ", "Checking out files:  39% (2469/6329)   ", "Checking out files:  40% (2532/6329)   ", "Checking out files:  41% (2595/6329)   ", "Checking out files:  42% (2659/6329)   ", "Checking out files:  43% (2722/6329)   ", "Checking out files:  44% (2785/6329)   ", "Checking out files:  45% (2849/6329)   ", "Checking out files:  46% (2912/6329)   ", "Checking out files:  47% (2975/6329)   ", "Checking out files:  48% (3038/6329)   ", "Checking out files:  49% (3102/6329)   ", "Checking out files:  50% (3165/6329)   ", "Checking out files:  51% (3228/6329)   ", "Checking out files:  52% (3292/6329)   ", "Checking out files:  53% (3355/6329)   ", "Checking out files:  54% (3418/6329)   ", "Checking out files:  55% (3481/6329)   ", "Checking out files:  56% (3545/6329)   ", "Checking out files:  57% (3608/6329)   ", "Checking out files:  58% (3671/6329)   ", "Checking out files:  59% (3735/6329)   ", "Checking out files:  60% (3798/6329)   ", "Checking out files:  61% (3861/6329)   ", "Checking out files:  62% (3924/6329)   ", "Checking out files:  63% (3988/6329)   ", "Checking out files:  64% (4051/6329)   ", "Checking out files:  65% (4114/6329)   ", "Checking out files:  66% (4178/6329)   ", "Checking out files:  67% (4241/6329)   ", "Checking out files:  68% (4304/6329)   ", "Checking out files:  69% (4368/6329)   ", "Checking out files:  70% (4431/6329)   ", "Checking out files:  71% (4494/6329)   ", "Checking out files:  72% (4557/6329)   ", "Checking out files:  73% (4621/6329)   ", "Checking out files:  74% (4684/6329)   ", "Checking out files:  75% (4747/6329)   ", "Checking out files:  76% (4811/6329)   ", "Checking out files:  77% (4874/6329)   ", "Checking out files:  78% (4937/6329)   ", "Checking out files:  79% (5000/6329)   ", "Checking out files:  79% (5054/6329)   ", "Checking out files:  80% (5064/6329)   ", "Checking out files:  81% (5127/6329)   ", "Checking out files:  82% (5190/6329)   ", "Checking out files:  83% (5254/6329)   ", "Checking out files:  84% (5317/6329)   ", "Checking out files:  85% (5380/6329)   ", "Checking out files:  86% (5443/6329)   ", "Checking out files:  87% (5507/6329)   ", "Checking out files:  88% (5570/6329)   ", "Checking out files:  89% (5633/6329)   ", "Checking out files:  90% (5697/6329)   ", "Checking out files:  91% (5760/6329)   ", "Checking out files:  92% (5823/6329)   ", "Checking out files:  93% (5886/6329)   ", "Checking out files:  94% (5950/6329)   ", "Checking out files:  95% (6013/6329)   ", "Checking out files:  96% (6076/6329)   ", "Checking out files:  97% (6140/6329)   ", "Checking out files:  98% (6203/6329)   ", "Checking out files:  98% (6244/6329)   ", "Checking out files:  98% (6252/6329)   ", "Checking out files:  99% (6266/6329)   ", "Checking out files:  99% (6282/6329)   ", "Checking out files:  99% (6328/6329)   ", "Checking out files: 100% (6329/6329)   ", "Checking out files: 100% (6329/6329), done.", "INFO:bench.app:installing erpnext", "INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext --no-cache-dir", "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 <module>", "    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/utils.py\", line 20, in build", "    frappe.build.bundle(no_compress, make_copy=make_copy, restore = restore, verbose=verbose)", "  File \"/home/frappe/frappe-bench/apps/frappe/frappe/build.py\", line 40, in bundle", "    subprocess.call(command.split(' '))", "  File \"/usr/lib/python2.7/subprocess.py\", line 523, in call", "    return Popen(*popenargs, **kwargs).wait()", "  File \"/usr/lib/python2.7/subprocess.py\", line 711, in __init__", "    errread, errwrite)", "  File \"/usr/lib/python2.7/subprocess.py\", line 1343, in _execute_child", "    raise child_exception", "OSError: [Errno 2] No such file or directory"], "stdout": "('installing', u'erpnext')", "stdout_lines": ["('installing', u'erpnext')"]}
	to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost                  : ok=74   changed=19   unreachable=0    failed=1   

Traceback (most recent call last):
  File "install.py", line 387, in <module>
    install_bench(args)
  File "install.py", line 109, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 325, 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

I manually attempted the failed command (as the frappe user, after removing the app/erpnext dir) and this is the error I got:

frappe@ubuntu:~/frappe-bench$ bench get-app erpnext https://github.com/frappe/erpnext --branch master
INFO:bench.app:getting app erpnext
INFO:bench.utils:git clone https://github.com/frappe/erpnext --branch master --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Counting objects: 6374, done.
remote: Compressing objects: 100% (5635/5635), done.
remote: Total 6374 (delta 1212), reused 3251 (delta 574), pack-reused 0
Receiving objects: 100% (6374/6374), 179.91 MiB | 966.00 KiB/s, done.
Resolving deltas: 100% (1212/1212), done.
Checking connectivity... done.
Checking out files: 100% (6329/6329), done.
('installing', u'erpnext')
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext --no-cache-dir
Exception:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/req/req_set.py", line 521, in _prepare_file
    req_to_install.check_if_exists()
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1036, in check_if_exists
    self.req.name
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 558, in get_distribution
    dist = get_provider(dist)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 432, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py", line 859, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
ContextualVersionConflict: (python-dateutil 2.7.1 (/home/frappe/frappe-bench/env/lib/python2.7/site-packages), Requirement.parse('python-dateutil<2.7.0,>=2.1'), set(['botocore']))
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, 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 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/make.py", line 38, in get_app
    get_app(git_url, branch=branch)
  File "/home/frappe/.bench/bench/app.py", line 106, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/home/frappe/.bench/bench/app.py", line 137, in install_app
    find_links=find_links))
  File "/home/frappe/.bench/bench/utils.py", line 152, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q  -e ./apps/erpnext --no-cache-dir

What can I do to solve this?

@oxwivi

Are you in MAC or Windows or Linux?
With pip install failure you can get answers / solution trough search as well.

Linux, Ubuntu. You could install on Windows?

I’m asking here because I a;ready used the script to successfully install on Ubuntu Desktop, but this error showed up on Ubuntu Server.