Sudo bash setup_frappe.sh not creating a frappe-bench directory

Hello pratik,

On local machine(ubuntu 14.10), when i try to setup bench with “sudo bash setup_frappe.sh”; its not making a “frappe-bench” directory. Error log…

nescode@nccorplap001:~$ git clone https://github.com/frappe/bench bench-repo
Cloning into 'bench-repo'...
remote: Counting objects: 744, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 744 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (744/744), 147.79 KiB | 85.00 KiB/s, done.
Resolving deltas: 100% (479/479), done.
Checking connectivity... done.
nescode@nccorplap001:~$ sudo pip install -e bench-repo
Obtaining file:///home/nescode/bench-repo
  Running setup.py (path:/home/nescode/bench-repo/setup.py) egg_info for package from file:///home/nescode/bench-repo
    
    file bench.py (for module bench) not found
Requirement already satisfied (use --upgrade to upgrade): Click in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): jinja2 in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): honcho in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): semantic-version in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): GitPython==0.3.2.RC1 in /usr/local/lib/python2.7/dist-packages (from bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python2.7/dist-packages (from jinja2->bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): gitdb>=0.5.1 in /usr/local/lib/python2.7/dist-packages (from GitPython==0.3.2.RC1->bench==0.1)
Requirement already satisfied (use --upgrade to upgrade): smmap>=0.8.3 in /usr/local/lib/python2.7/dist-packages (from gitdb>=0.5.1->GitPython==0.3.2.RC1->bench==0.1)
Installing collected packages: bench
  Running setup.py develop for bench
    
    file bench.py (for module bench) not found
    Creating /usr/local/lib/python2.7/dist-packages/bench.egg-link (link to .)
    bench 0.1 is already the active version in easy-install.pth
    Installing bench script to /usr/local/bin
    
    Installed /home/nescode/bench-repo
Successfully installed bench
Cleaning up...
nescode@nccorplap001:~$ bench init frappe-bench && frappe-bench
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/nescode/bench-repo/bench/cli.py", line 34, in cli
    change_dir()
  File "/home/nescode/bench-repo/bench/cli.py", line 66, in change_dir
    os.chdir(dir_path)
OSError: [Errno 2] No such file or directory: '/home/nescode/frappe-bench'
nescode@nccorplap001:~$ cd ~
nescode@nccorplap001:~$ bench init frappe-bench
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/nescode/bench-repo/bench/cli.py", line 34, in cli
    change_dir()
  File "/home/nescode/bench-repo/bench/cli.py", line 66, in change_dir
    os.chdir(dir_path)
OSError: [Errno 2] No such file or directory: '/home/nescode/frappe-bench'
nescode@nccorplap001:~$ 

Sunil

Even automated script also results into same error:

nescode@nccorplap001:~$ wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
--2014-11-29 12:56:11--  https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11773 (11K) [text/plain]
Saving to: ‘setup_frappe.sh’

100%[======================================>] 11,773      47.0KB/s   in 0.2s   

2014-11-29 12:56:13 (47.0 KB/s) - ‘setup_frappe.sh’ saved [11773/11773]

nescode@nccorplap001:~$ sudo bash setup_frappe.sh
Installing for Ubuntu utopic amd64
In case you encounter an error, you can post on https://discuss.frappe.io

Installing packages for Ubuntu. This might take time...
Installing wkhtmltopdf
Cannot install wkhtmltodpdf. Skipping...
Adding frappe user
Installing frappe-bench
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/nescode/bench-repo/bench/cli.py", line 34, in cli
    change_dir()
  File "/home/nescode/bench-repo/bench/cli.py", line 66, in change_dir
    os.chdir(dir_path)
OSError: [Errno 2] No such file or directory: '/home/nescode/frappe-bench'
nescode@nccorplap001:~$ 

Sunil

Hi pratik,

I created “frappe-bench” directory manually and then initiated the installation then also it given error.

nescode@nccorplap001:~$ sudo bash setup_frappe.sh
Installing for Ubuntu utopic amd64
In case you encounter an error, you can post on https://discuss.frappe.io

Installing packages for Ubuntu. This might take time...
Installing wkhtmltopdf
Cannot install wkhtmltodpdf. Skipping...
Adding frappe user
Installing frappe-bench
Already using interpreter /usr/bin/python
Cloning into 'frappe'...
Compiling /home/nescode/frappe-bench/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py ...
  File "/home/nescode/frappe-bench/frappe-bench/env/build/gunicorn/gunicorn/workers/_gaiohttp.py", line 64
    yield from self.wsgi.close()
             ^
SyntaxError: invalid syntax

Wrote ./assets/js/frappe-web.min.js - 90k
Wrote ./assets/js/print_format_v3.min.js - 18k
Wrote ./assets/css/frappe.css - 225k
Wrote ./assets/css/frappe-web.css - 163k
Wrote ./assets/js/editor.min.js - 27k
Wrote ./assets/js/frappe.min.js - 608k
Wrote ./assets/js/slickgrid.min.js - 102k
Wrote ./assets/js/canvasResize.min.js - 22k
Cloning into 'erpnext'...
error: RPC failed; result=56, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
installing frappe
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/nescode/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/nescode/bench-repo/bench/cli.py", line 105, in init
    no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch)
  File "/home/nescode/bench-repo/bench/utils.py", line 57, in init
    install_apps_from_path(apps_path, bench=path)
  File "/home/nescode/bench-repo/bench/app.py", line 81, in install_apps_from_path
    get_app(app['name'], app['url'], branch=app.get('branch'), bench=bench)
  File "/home/nescode/bench-repo/bench/app.py", line 42, in get_app
    cwd=os.path.join(bench, 'apps'))
  File "/home/nescode/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'git clone https://github.com/frappe/erpnext   --origin upstream erpnext' returned non-zero exit status 128
nescode@nccorplap001:~$ ^C
nescode@nccorplap001:~$ 

Sunil

What is the output of cat /etc/frappe_bench_dir?

nescode@nccorplap001:~$ cat /etc/frappe_bench_dir
/home/nescode/frappe-bench
nescode@nccorplap001:~$ 

Sunil

1 Like

yeah, remove the file /etc/frappe_bench_dir and try again.

nescode@nccorplap001:~$ sudo bash setup_frappe.sh
Installing for Ubuntu utopic amd64
In case you encounter an error, you can post on https://discuss.frappe.io

Installing packages for Ubuntu. This might take time...
Installing wkhtmltopdf
Cannot install wkhtmltodpdf. Skipping...
Adding frappe user
Installing frappe-bench
Setting up first site
Traceback (most recent call last):
  File "/home/nescode/frappe-bench/env/bin/frappe", line 9, in <module>
    load_entry_point('frappe==4.6.1', 'console_scripts', 'frappe')()
  File "/home/nescode/frappe-bench/apps/frappe/frappe/cli.py", line 53, in main
    return run(fn, parsed_args)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/cli.py", line 81, in run
    out = globals().get(fn)(*args.get(fn), **args)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/cli.py", line 67, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/cli.py", line 328, in install
    _install(db_name, root_login, root_password, source_sql, admin_password, force, site_config, reinstall, quiet, install_apps)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/cli.py", line 309, in _install
    admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/installer.py", line 31, in install_db
    create_database_and_user(force, verbose)
  File "/home/nescode/frappe-bench/apps/frappe/frappe/installer.py", line 48, in create_database_and_user
    if force or (db_name not in dbman.get_database_list()):
  File "/home/nescode/frappe-bench/apps/frappe/frappe/model/db_schema.py", line 359, in get_database_list
    return [d[0] for d in self.db.sql("SHOW DATABASES")]
  File "/home/nescode/frappe-bench/apps/frappe/frappe/database.py", line 79, in sql
    self.connect()
  File "/home/nescode/frappe-bench/apps/frappe/frappe/database.py", line 49, in connect
    use_unicode=True, charset='utf8')
  File "/home/nescode/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/home/nescode/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/nescode/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/nescode/bench-repo/bench/cli.py", line 128, in new_site
    _new_site(site, mariadb_root_password=mariadb_root_password, admin_password=admin_password)
  File "/home/nescode/bench-repo/bench/utils.py", line 86, in new_site
    ), cwd=os.path.join(bench, 'sites'))
  File "/home/nescode/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/home/nescode/frappe-bench/env/bin/frappe --install site1.local site1.local --root_password E7JwO3J9Gg1uE6i2 --admin_password CpxBtcOGYTWeRHvr' returned non-zero exit status 1

Issue has been resolved. Thx u so much pratik.

Sunil