Bench Update - Various Issues

I have ERPNext installed on my Ubuntu Desktop. When I run bench update I get the following error:

jay@epoch-jay:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe

  • branch develop -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From https://github.com/frappe/erpnext
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling frappe_ldap
    From https://github.com/saurabh6790/frappe_ldap
  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext_shopify
    From https://github.com/frappe/erpnext_shopify
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
    main()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/jay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe.dict(ctx.obj), *args, **kwargs)
    File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 279, in backup
    odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, force=True)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 165, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 175, in new_backup
    odb.get_backup(older_than, ignore_files, force=force)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 48, in get_backup
    self.set_backup_file_name()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 63, in set_backup_file_name
    todays_date = now_datetime().strftime(’%Y%m%d
    %H%M%S’)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 116, in now_datetime
    dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 136, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_time_zone()))
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 130, in get_time_zone
    return frappe.cache().get_value(“time_zone”, _get_time_zone)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 68, in get_value
    val = generator()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 124, in _get_time_zone
    return frappe.db.get_system_setting(‘time_zone’) or ‘Asia/Kolkata’
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 803, in get_system_setting
    return frappe.cache().get_value(“system_settings”, _load_system_settings).get(key)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 68, in get_value
    val = generator()
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 802, in _load_system_settings
    return self.get_singles_dict(“System Settings”)
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 514, in get_singles_dict
    tabSingles where doctype=%s""", doctype))
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 106, in sql
    self.connect()
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 52, in connect
    use_unicode=True, charset=‘utf8’)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
    return Connection(*args, **kwargs)
    File “/home/jay/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 ‘1bd3e0294da19198’@‘localhost’ (using password: YES)”)

When I load up the site on http://localhost:8001 I get the We will be back soon screen.

I run sudo service supervisor restart and after about half a minute the site loads, but when I click login I get the following error:

Traceback (most recent call last):
File “/home/jay/frappe-bench/apps/frappe/frappe/website/render.py”, line 32, in render
data = render_page_by_language(path)
File “/home/jay/frappe-bench/apps/frappe/frappe/website/render.py”, line 101, in render_page_by_language
return render_page(path)
File “/home/jay/frappe-bench/apps/frappe/frappe/website/render.py”, line 117, in render_page
return build(path)
File “/home/jay/frappe-bench/apps/frappe/frappe/website/render.py”, line 124, in build
return build_page(path)
File “/home/jay/frappe-bench/apps/frappe/frappe/website/render.py”, line 140, in build_page
html = frappe.render_template(context.source, context)
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 50, in render_template
return get_jenv().from_string(template).render(context)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 989, in render
return self.environment.handle_exception(exc_info, True)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 78, in top-level template code
File “”, line 78, in block “script_lib”
File “/home/jay/frappe-bench/apps/frappe/frappe/./templates/includes/login/login.js”, line 58, in top-level template code
args.cmd = “{{ ldap_settings.method }}”;
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 408, in getattr
return getattr(obj, attribute)
UndefinedError: ‘ldap_settings’ is undefined

So, if I try to uninstall ldap using the command bench --site pppl.local uninstall-app frappe_ldap and I get the following error:

jay@epoch-jay:~/frappe-bench$ bench --site pppl.local uninstall-app frappe_ldap
All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? y
Backing up…
removing DocType LDAP Settings…
Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 315, in uninstall
remove_app(app, dry_run, yes)
File “/home/jay/frappe-bench/apps/frappe/frappe/installer.py”, line 190, in remove_app
frappe.delete_doc(“DocType”, doctype.name)
File “/home/jay/frappe-bench/apps/frappe/frappe/init.py”, line 625, in delete_doc
ignore_permissions, flags)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 103, in delete_doc
insert_feed(doc)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/delete_doc.py”, line 261, in insert_feed
}).insert(ignore_permissions=True)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/document.py”, line 197, in insert
self.run_method(“before_insert”)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/document.py”, line 656, in run_method
self.run_email_alerts(method)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/document.py”, line 677, in run_email_alerts
filters={‘enabled’: 1, ‘document_type’: self.doctype})
File “/home/jay/frappe-bench/apps/frappe/frappe/init.py”, line 1097, in get_all
return get_list(doctype, *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/init.py”, line 1070, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 80, in execute
result = self.build_and_run()
File “/home/jay/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 104, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 148, in sql
self._cursor.execute(query)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1054, “Unknown column ‘method’ in ‘field list’”)

How do I manage these various issues?

Thanks

Jay

Not sure if this will help but from /frappe-bench/:
bench uninstall-apps my_app_name
Then
bench remove-from-installed-apps my_app_name
(Or the other way round, I can’t remember.)
Then:
sudo service nginx reload
sudo supervisorctl reload

Let us try this first:

bench restart
bench update

And let us know the output

Here is the output:

jay@epoch-jay:~/frappe-bench$ bench restart
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started
jay@epoch-jay:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe

  • branch develop -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From https://github.com/frappe/erpnext
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling frappe_ldap
    From https://github.com/saurabh6790/frappe_ldap
  • branch master -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext_shopify
    From https://github.com/frappe/erpnext_shopify
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7efdb2108550>: Failed to establish a new connection: [Errno 101] Network is unreachable’,)’: /simple/pip/
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Traceback (most recent call last):
    File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
    main”, fname, loader, pkg_name)
    File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
    exec code in run_globals
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
    main()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
    return callback(*args, **kwargs)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/jay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe.dict(ctx.obj), *args, **kwargs)
    File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 279, in backup
    odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, force=True)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 165, in scheduled_backup
    odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 175, in new_backup
    odb.get_backup(older_than, ignore_files, force=force)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 48, in get_backup
    self.set_backup_file_name()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 63, in set_backup_file_name
    todays_date = now_datetime().strftime(’%Y%m%d
    %H%M%S’)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 116, in now_datetime
    dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 136, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_time_zone()))
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 130, in get_time_zone
    return frappe.cache().get_value(“time_zone”, _get_time_zone)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 68, in get_value
    val = generator()
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/data.py”, line 124, in _get_time_zone
    return frappe.db.get_system_setting(‘time_zone’) or ‘Asia/Kolkata’
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 803, in get_system_setting
    return frappe.cache().get_value(“system_settings”, _load_system_settings).get(key)
    File “/home/jay/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 68, in get_value
    val = generator()
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 802, in _load_system_settings
    return self.get_singles_dict(“System Settings”)
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 514, in get_singles_dict
    tabSingles where doctype=%s""", doctype))
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 106, in sql
    self.connect()
    File “/home/jay/frappe-bench/apps/frappe/frappe/database.py”, line 52, in connect
    use_unicode=True, charset=‘utf8’)
    File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
    return Connection(*args, **kwargs)
    File “/home/jay/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 ‘1bd3e0294da19198’@‘localhost’ (using password: YES)”)

Both commands give me the following error:

jay@epoch-jay:~/frappe-bench$ bench remove-from-installed-apps frappe_ldapTraceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 174, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/jay/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/jay/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/jay/frappe-bench/apps/frappe/frappe/commands/site.py”, line 295, in remove_from_installed_apps
for site in context.sites:
TypeError: ‘NoneType’ object is not iterable

You seem to be having a MySQL but also in general a connectivity issue on the server. It failed to connect to pip 4 times then access failed on MySQL.

Check server internet connection first

ping google.com

Then try this

mysql
show databases;

And try this

pip install -U pip

Let us know the results

Okay, sorted it all out. The first issue, the key lay in this part of the error message:

mysqlexceptions.OperationalError: (1045, “Access denied for user ‘1bd3e0294da19198’@‘localhost’ (using password: YES)”)

I changed the password to the user 1bd3e0294da19198 to what was already in the site_config.json file and that addressed that problem.

Next on the ldap issue. Uninstalled frappe_ldap from a specific site using the commands bench --site pppl.local uninstall-app frappe_ldap and bench --site pppl.local remove-from-installed-apps frappe_ldap

Restaarted nginx and supervisor and everything’s well now. Thanks for all your help.

Cheers

Jay