Bench install on Easy setup failing - NO pip.req

Hey Guys,
I’ve been setting up ERPnext on Vultr VPS five six times now using the install.py script but now its failing see below, while trying to narrow down, something is turning up saying pip.req, req module not found, Any ideas?

TASK [bench : move /tmp/.bench if it exists] ***********************************
skipping: [localhost]

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\n    Complete output from command python setup.py egg_info:\n    Traceback (most recent call last):\n      File \"<string>\", line 1, in <module>\n      File \"/home/frappe/.bench/setup.py\", line 2, in <module>\n        from pip.req import parse_requirements\n    ImportError: No module named req\n    \n    ----------------------------------------\n\n:stderr: Command \"python setup.py egg_info\" failed with error code 1 in /home/frappe/.bench/\n"}
    to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost                  : ok=66   changed=12   unreachable=0    failed=1

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

Seems the problem is related with pip. Pip 10.x doesn’t support anymore pip.req.
I’ve partially solved downgrading the pip version installed with the following command:
sudo pip install pip==9.0.3, changinf the row 40 of install.py from:
‘apt-get’: ‘sudo pip install --upgrade setuptools pip’,
to
‘apt-get’: ‘sudo pip install pip==9.0.3’,

Than I had also to change the setup.py in the .branch directory, inside the branch the same way

Thanks for this, just saw pip 10 was released 10hrs ago

Yes, it’s a pip 10 issue.

pip.req has been moved into pip._internal.req

Bench has been fixed. I’ve sent in PRs for frappe and erpnext as well, should get merged in some time.

https://github.com/frappe/frappe/pull/5447
https://github.com/frappe/erpnext/pull/13661

Hi seems its failing elsewhere as well

TASK [bench : python3 bench init for develop] **********************************
skipping: [localhost]

TASK [bench : python2 bench init for production] *******************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "init", "/home/frappe/frappe-bench", "--frappe-branch", "master"], "delta": "0:00:23.110291", "end": "2018-04-15 06:20:35.064473", "msg": "non-zero return code", "rc": 1, "start": "2018-04-15 06:20:11.954182", "stderr": "INFO:bench.utils:virtualenv -q env -p /usr/bin/python\nINFO:bench.utils:./env/bin/pip -q install --upgrade pip\nINFO:bench.utils:./env/bin/pip -q install wheel\nINFO:bench.utils:./env/bin/pip -q install six\nINFO:bench.utils:./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit\nINFO:bench.app:getting app frappe\nINFO:bench.utils:git clone https://github.com/frappe/frappe.git --branch master  --origin upstream\nCloning into 'frappe'...\nINFO:bench.app:installing frappe\nINFO:bench.utils:/home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir\nCommand \"python setup.py egg_info\" failed with error code 1 in /home/frappe/frappe-bench/apps/frappe/\nTraceback (most recent call last):\n  File \"/usr/local/bin/bench\", line 11, in <module>\n    load_entry_point('bench', 'console_scripts', 'bench')()\n  File \"/home/frappe/.bench/bench/cli.py\", line 40, in cli\n    bench_command()\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 722, in __call__\n    return self.main(*args, **kwargs)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 697, in main\n    rv = self.invoke(ctx)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 1066, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 895, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 535, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/frappe/.bench/bench/commands/make.py\", line 30, in init\n    python \t\t = python)\n  File \"/home/frappe/.bench/bench/utils.py\", line 75, in init\n    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)\n  File \"/home/frappe/.bench/bench/app.py\", line 133, in get_app\n    install_app(app=app_name, bench_path=bench_path, verbose=verbose)\n  File \"/home/frappe/.bench/bench/app.py\", line 164, in install_app\n    find_links=find_links))\n  File \"/home/frappe/.bench/bench/utils.py\", line 153, in exec_cmd\n    raise CommandFailedError(cmd)\nbench.utils.CommandFailedError: /home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir", "stderr_lines": ["INFO:bench.utils:virtualenv -q env -p /usr/bin/python", "INFO:bench.utils:./env/bin/pip -q install --upgrade pip", "INFO:bench.utils:./env/bin/pip -q install wheel", "INFO:bench.utils:./env/bin/pip -q install six", "INFO:bench.utils:./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit", "INFO:bench.app:getting app frappe", "INFO:bench.utils:git clone https://github.com/frappe/frappe.git --branch master  --origin upstream", "Cloning into 'frappe'...", "INFO:bench.app:installing frappe", "INFO:bench.utils:/home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir", "Command \"python setup.py egg_info\" failed with error code 1 in /home/frappe/frappe-bench/apps/frappe/", "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 30, in init", "    python \t\t = python)", "  File \"/home/frappe/.bench/bench/utils.py\", line 75, in init", "    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)", "  File \"/home/frappe/.bench/bench/app.py\", line 133, in get_app", "    install_app(app=app_name, bench_path=bench_path, verbose=verbose)", "  File \"/home/frappe/.bench/bench/app.py\", line 164, in install_app", "    find_links=find_links))", "  File \"/home/frappe/.bench/bench/utils.py\", line 153, in exec_cmd", "    raise CommandFailedError(cmd)", "bench.utils.CommandFailedError: /home/frappe/frappe-bench/env/bin/pip install -q  -e /home/frappe/frappe-bench/apps/frappe --no-cache-dir"], "stdout": "Already using interpreter /usr/bin/python\n('installing', u'frappe')", "stdout_lines": ["Already using interpreter /usr/bin/python", "('installing', u'frappe')"]}
    to retry, use: --limit @/tmp/.bench/playbooks/site.retry

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

Traceback (most recent call last):
  File "install.py", line 396, in <module>
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

PR hasn’t been merged yet, as I mentioned Frappe and ERPNext are yet to be fixed!

2 Likes

@codingCoffee
Getting same issue. How much time it will take?

TASK [bench : install bench] ***************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “cmd”: “/bin/pip2 install -e /home/frappe/.bench”, “msg”: “stdout: Obtaining file:///home/frappe/.bench\n Complete output from command python setup.py egg_info:\n Traceback (most recent call last):\n File "", line 1, in \n File "/home/frappe/.bench/setup.py", line 2, in \n from pip.req import parse_requirements\n ImportError: No module named req\n \n ----------------------------------------\n\n:stderr: Command "python setup.py egg_info" failed with error code 1 in /home/frappe/.bench/\n”}
to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost : ok=66 changed=35 unreachable=0 failed=1

HEY! USE SCREEN -bash-4.2# pip --version
pip 10.0.0 from /usr/lib/python2.7/site-packages/pip (python 2.7)

@bhavikpatel7023 The issue has already been fixed.

@codingCoffee
Still I’m facing same problem.

TASK [bench : move /tmp/.bench if it exists] ***********************************
changed: [localhost]

TASK [bench : install bench] ***************************************************
fatal: [localhost]: FAILED! => {“changed”: false, “cmd”: “/bin/pip2 install -e /home/frappe/.bench”, “msg”: “stdout: Obtaining file:///home/frappe/.bench\n Complete output from command python setup.py egg_info:\n Traceback (most recent call last):\n File "", line 1, in \n File "/home/frappe/.bench/setup.py", line 2, in \n from pip.req import parse_requirements\n ImportError: No module named req\n \n ----------------------------------------\n\n:stderr: Command "python setup.py egg_info" failed with error code 1 in /home/frappe/.bench/\n”}
to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP *********************************************************************
localhost : ok=64 changed=9 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/lib64/python2.7/subprocess.py”, line 542, 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
bash-4.2# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)
bash-4.2# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
bash-4.2# pip --versionpip --version

Usage:
pip [options]

no such option: --versionpip
bash-4.2# pip --version
pip 10.0.0 from /usr/lib/python2.7/site-packages/pip (python 2.7)
bash-4.2#

Switch to frappe user. Goto /home/frappe/.bench folder and do a git pull and then run the install script again as root user.

Or

Do a fresh install on a black server

@codingCoffee
I tried following commands:

Switch to frappe user. Goto /home/frappe/.bench folder and do a git pull and then run the install script again as root user.
and i tried on 2 fresh servers.
but still getting

TASK [bench : python2 bench init for production] *******************************
fatal: [localhost]: FAILED! => {“changed”: true, “cmd”: [“bench”, “init”, “/home/frappe2/frappe-bench”, “–frappe-branch”, “master”], “delta”: “0:00:00.139708”, “end”: “2018-04-17 05:23:52.220751”, “msg”: “non-zero return code”, “rc”: 1, “start”: “2018-04-17 05:23:52.081043”, “stderr”: “Traceback (most recent call last):\n File "/bin/bench", line 6, in \n from pkg_resources import load_entry_point\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3088, in \n @_call_aside\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3072, in _call_aside\n f(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3101, in _initialize_master_working_set\n working_set = WorkingSet._build_master()\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 574, in _build_master\n ws.require(requires)\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 892, in require\n needed = self.resolve(parse_requirements(requirements))\n File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 778, in resolve\n raise DistributionNotFound(req, requirers)\npkg_resources.DistributionNotFound: The ‘GitPython==0.3.2.1’ distribution was not found and is required by bench”, “stderr_lines”: [“Traceback (most recent call last):”, " File "/bin/bench", line 6, in “, " from pkg_resources import load_entry_point”, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3088, in “, " @_call_aside”, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3072, in _call_aside", " f(*args, **kwargs)“, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 3101, in _initialize_master_working_set”, " working_set = WorkingSet._build_master()“, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 574, in _build_master”, " ws.require(requires)“, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 892, in require”, " needed = self.resolve(parse_requirements(requirements))“, " File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 778, in resolve”, " raise DistributionNotFound(req, requirers)", “pkg_resources.DistributionNotFound: The ‘GitPython==0.3.2.1’ distribution was not found and is required by bench”], “stdout”: “”, “stdout_lines”: }

before i did this:

for installation steps

Hi, I tried on two fresh VPS servers yesterday, it was all good here. It was on Ubuntu 16.04 if it helps

Steps

$ sudo apt-get install python-dev python-setuptools python-mysqldb python-pip
$ sudo apt-get update && sudo apt-get -y upgrade
$ cd && wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
$ python install.py --production --user frappe