Bench Init : - bench init erpnext && cd erpnext : bench.utils.CommandFailedError: virtualenv -q env -p /usr/bin/python3

Hi Team,

I am trying to install ERPNext on AWS instance…

While running bench init erpnext && cd erpnext giving some output like bench.utils.CommandFailedError: virtualenv -q env -p /usr/bin/python3

bench@ip-172-31-39-157:~$ bench init erpnext && cd erpnext
INFO:bench.utils:virtualenv -q env -p /usr/bin/python3
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/”, line 24, in
import distutils.spawn
ModuleNotFoundError: No module named ‘distutils.spawn’
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/opt/bench/bench-repo/bench/”, line 40, in cli
File “/usr/local/lib/python2.7/dist-packages/click/”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/bench/bench-repo/bench/commands/”, line 31, in init
python = python)
File “/opt/bench/bench-repo/bench/”, line 65, in init
setup_env(bench_path=path, python = python)
File “/opt/bench/bench-repo/bench/”, line 178, in setup_env
exec_cmd(‘virtualenv -q {} -p {}’.format(‘env’, python), cwd=bench_path)
File “/opt/bench/bench-repo/bench/”, line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: virtualenv -q env -p /usr/bin/python3

How to solve this…

you need to install python3 and setuptools

@ical, please update how to install .

I have the same error when doing bench migrate-env python3 and I already have python3 installed and setuptools

@Iulian_Olaru just try with python2.7 install

Yep, using that at this moment but with the warnings on each update about deprecation etc… not sure if there is any urgency to use python3

@Iulian_Olaru yes for python 2.7 support will be stopped. Warning msg will be shown as notification.

Hence this brings up the subject, how do you eventually migrate to python3 ? I see on the forum almost nobody was able to do it.

yes migrate to python 3 is not having a solution.You just create a new issue in forum,so you will get more replies for that issue.

if you are using ubuntu, then follow this guide

@ical ok thank yu…let me try.