Bench can't install ERPNext due to ContextualVersionConflict

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: 6375, done.
remote: Compressing objects: 100% (5637/5637), done.
remote: Total 6375 (delta 1213), reused 3245 (delta 573), pack-reused 0
Receiving objects: 100% (6375/6375), 179.91 MiB | 1.24 MiB/s, done.
Resolving deltas: 100% (1213/1213), done.
Checking connectivity... done.
Checking out files: 100% (6330/6330), 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.2 (/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

Please help me solve this.

Here is a point of reference with my current

frappe@ubuntu:~/frappe-bench$ pip list | grep python
python-apt (1.1.0b1+ubuntu0.16.4.1)
python-crontab (2.2.8)
python-dateutil (2.7.0)

frappe@ubuntu:~/frappe-bench$ less apps/frappe/requirements.txt
frappe@ubuntu:~/frappe-bench$ less apps/frappe/requirements.txt | grep dateutil
python-dateutil
frappe@ubuntu:~/frappe-bench$ bench version
erpnext 10.1.13
frappe 10.1.6

Maybe uninstall python-dateutil or override?

or just rm apps/frappe?

IDK what difference it makes, but running bench get-app erpnext https://github.com/frappe/erpnext without the branch argument let me successfully install. Logically speaking it should be downloading from the master branch by default, but I succeeded with just letting it go unmentioned.

This now impacts the default master install regardless of if you specify flags or not.

I discovered that this is caused by the botocore package, which is used for the S3 backup integration. They changed their requirements to stipulate python-dateutil>=2.1,<2.7.0.

Locally, I solved this by entering the bench virtualenv and uninstalling the module and manually installing one within the requirements (for me that was 2.6.1)

$ cd /path/to/your/bench
$ . env/bin/activate
(env) $ pip uninstall python-dateutil
  Uninstalling python-dateutil-2.7.2:

<output trimmed>

Proceed (y/n)? y
  Successfully uninstalled python-dateutil-2.7.2
(env) $ pip install python-dateutil==
Collecting python-dateutil==
  Could not find a version that satisfies the requirement python-dateutil== (from versions: 1.4, 1.4.1, 1.5, 2.1, 2.2, 2.3, 2.4.0, 2.4.1, 2.4.1.post1, 2.4.2, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0, 2.6.1, 2.7.0, 2.7.1, 2.7.2)
No matching distribution found for python-dateutil==
(env) $ pip install python-dateutil==2.6.1
Collecting python-dateutil==2.6.1

<output trimmed>

Successfully installed python-dateutil-2.6.1
(env) $ deactivate

Perhaps the dev team could have a look at this and see about an ideal solution? To me it seems the most straight-foreward would be to have a cleaner way to choose when and how to setup integrations, rather than bundling them all in the default package. This could resolve a lot of issues and make people pleased with less of a footprint.

2 Likes

@codingCoffee, please take a look at it.

As @tenninjas correctly mentioned it does seem like a botocore issue. It is still open and people have sent PRs to fix it. Relax upper bound on python-dateutil · Issue #1429 · boto/botocore · GitHub
Let’s waiit for a while and see if it gets resolved.