Frappe Bench using Python3.5 instead of default 2.7

So, since we are unable Setting up Production System in Vagrant Ubuntu 14 LTS with 7 Beta and due to the Error during Beta Development Setup in Ubuntu 14 I am trying to set up ERPNext on my Mac OS X but since the installers dont seem to work reliably I am just executing the 3 lines of the Manual Setup in my environment that is set up via the guide Turning a Mac into a Frappe Framework Developer Machine:

git clone https://github.com/frappe/bench bench-repo
sudo pip install -e bench-repo
bench init frappe-bench

This throws this error, even though my default python is Python 2.7:

 ~/D/frappe-dev ❯❯❯ bench init frappe-bench
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3130, in <module>
    @_call_aside
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3116, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 3143, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 642, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 943, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.5/site-packages/pkg_resources/__init__.py", line 830, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'bench' distribution was not found and is required by the application

[edited]

@dominik your local python3 installation has overridden python call.

Try:

which python
brew uninstall python3
brew uninstall python
brew install python
which python
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py
rm /tmp/get-pip.py

Thank you for trying to help @anand however this doesn’t work quite yet.

returns curl: (3) <url> malformed

sorry! updated the commands

Thank you for updating the commands. I executed the commands and then re-ran the manual setup with the next error:

 ~/D/frappe-dev ❯❯❯ sudo rm -rf bench-repo                                    ⏎
Password:
 ~/D/frappe-dev ❯❯❯ git clone https://github.com/frappe/bench bench-repo
Cloning into 'bench-repo'...
remote: Counting objects: 2985, done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 2985 (delta 21), reused 0 (delta 0), pack-reused 2927
Receiving objects: 100% (2985/2985), 29.02 MiB | 1.67 MiB/s, done.
Resolving deltas: 100% (1821/1821), done.
Checking connectivity... done.
 ~/D/frappe-dev ❯❯❯ sudo pip install -e bench-repo
The directory '/Users/dominik/Library/Caches/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.
The directory '/Users/dominik/Library/Caches/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.
Obtaining file:///Users/dominik/Dev/frappe-dev/bench-repo
Requirement already satisfied (use --upgrade to upgrade): Click in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): jinja2 in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): honcho in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): semantic_version in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): GitPython==0.3.2.rc1 in /usr/local/lib/python2.7/site-packages (from bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /usr/local/lib/python2.7/site-packages (from jinja2->bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): gitdb>=0.5.1 in /usr/local/lib/python2.7/site-packages (from GitPython==0.3.2.rc1->bench==3.0.0)
Requirement already satisfied (use --upgrade to upgrade): smmap>=0.8.5 in /usr/local/lib/python2.7/site-packages (from gitdb>=0.5.1->GitPython==0.3.2.rc1->bench==3.0.0)
Installing collected packages: bench
  Running setup.py develop for bench
Successfully installed bench-3.0.0
 ~/D/frappe-dev ❯❯❯ bench init frappe-bench
/bin/sh: /usr/local/bin/virtualenv: /usr/local/opt/python3/bin/python3.5: bad interpreter: No such file or directory
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/commands/make.py", line 17, in init
    no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch, verbose=verbose)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/utils.py", line 57, in init
    setup_env(bench_path=path)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/utils.py", line 103, in setup_env
    exec_cmd('virtualenv -q {} -p {}'.format('env', sys.executable), cwd=bench_path)
  File "/Users/dominik/Dev/frappe-dev/bench-repo/bench/utils.py", line 100, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: virtualenv -q env -p /usr/local/opt/python/bin/python2.7

This is the python:

 ~/D/frappe-dev ❯❯❯ which python                                                                                                                                                   ⏎
/usr/local/bin/python
 ~/D/frappe-dev ❯❯❯ python --version
Python 2.7.11

@dominik how did you install python3?

I installed everything through brew @anand. Right now due to your script python3 is uninstalled.

Check the output of:

which virtualenv
virtualenv --version

@dominik can you come on chat at https://gitter.im? This can be done a lot quicker.

running sudo pip install --upgrade virtualenv helps