Unable to assign roles to a new user on stand-alone installation

Hi,

I am new to ERPNext, so started with the stand-alone installation. I am trying to create a new user, which doesn’t seem to work well. After creating the new user, I can’t assign any roles to the same. The roles are visible, but the checkbox is missing. It is the same for modules as well.

I tried restarting, which didn’t help. Then tried ‘bench update’ which said it is running the latest, however gave an error at the end, not really sure whether that is related…

spoojary@spoojary-home:~/frappe-bench $ bench version
erpnext 7.2.29
frappe 7.2.29

spoojary@spoojary-home:~/frappe-bench $ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
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.
    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/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
    main()
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
    return self.main(*args, **kwargs)
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
    rv = self.invoke(ctx)
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
    return callback(*args, **kwargs)
    File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
    ret = f(frappe.dict(ctx.obj), *args, **kwargs)
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 280, 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/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 175, in new_backup
    odb.get_backup(older_than, ignore_files, force=force)
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 48, in get_backup
    self.set_backup_file_name()
    File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 116, in now_datetime
    dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 139, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_time_zone()))
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 133, in get_time_zone
    return frappe.cache().get_value(“time_zone”, _get_time_zone)
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 70, in get_value
    val = generator()
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 127, in _get_time_zone
    return frappe.db.get_system_setting(‘time_zone’) or ‘Asia/Kolkata’
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 844, in get_system_setting
    return frappe.cache().get_value(“system_settings”, _load_system_settings).get(key)
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 70, in get_value
    val = generator()
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 843, in _load_system_settings
    return self.get_singles_dict(“System Settings”)
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 529, in get_singles_dict
    tabSingles where doctype=%s""", doctype))
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 107, in sql
    self.connect()
    File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 53, in connect
    use_unicode=True, charset=‘utf8mb4’)
    File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
    return Connection(*args, **kwargs)
    File “/home/spoojary/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 ‘47617c6bdd9edddf’@‘localhost’ (using password: YES)”)
    spoojary@spoojary-home:~/frappe-bench $
    spoojary@spoojary-home:~/frappe-bench $

Please try bench update once again and then check. @nabinhait any help please?

There was an issue to show checkboxes in Firefox browser, we have fixed it in the develop branch. Updating bench should fix the issue.

Seems like one site in your sites directory has not installed properly. Remove that site and then try to update again.

Thanks @nabinhait. I tried bench-update again and it worked.

There were two additional sites which I wasn’t using. I removed one using ‘bench drop-site’. However I couldn’t remove the other one. It failed with

spoojary@spoojary-home:~/frappe-bench $ bench drop-site site1.locl
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/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 334, in drop_site
scheduled_backup(ignore_files=False, force=True)
File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 175, in new_backup
odb.get_backup(older_than, ignore_files, force=force)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/backups.py”, line 48, in get_backup
self.set_backup_file_name()
File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 116, in now_datetime
dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 139, in convert_utc_to_user_timezone
return utcnow.astimezone(timezone(get_time_zone()))
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 133, in get_time_zone
return frappe.cache().get_value(“time_zone”, _get_time_zone)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 70, in get_value
val = generator()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/data.py”, line 127, in _get_time_zone
return frappe.db.get_system_setting(‘time_zone’) or ‘Asia/Kolkata’
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 844, in get_system_setting
return frappe.cache().get_value(“system_settings”, _load_system_settings).get(key)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py”, line 70, in get_value
val = generator()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 843, in _load_system_settings
return self.get_singles_dict(“System Settings”)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 529, in get_singles_dict
tabSingles where doctype=%s""", doctype))
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 107, in sql
self.connect()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 53, in connect
use_unicode=True, charset=‘utf8mb4’)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/init.py”, line 81, in Connect
return Connection(*args, **kwargs)
File “/home/spoojary/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 ‘47617c6bdd9edddf’@‘localhost’ (using password: YES)”)

Is that fine to just remove the site from sites directory or there is some way of force removing it?

Yes, delete the site from sites directory. And then go to mysql and drop the database “47617c6bdd9edddf”, if exists.

Thanks @nabinhait,

I removed the site, but there was no database to remove. However that didn’t remove the error. So I thought of starting from beginning by removing the last site and creating a new one. Creating a new one resulted in

spoojary@spoojary-home:~/frappe-bench $ bench new-site site.skpi
MySQL root password:
Installing frappe…
Updating DocTypes for frappe : [========================================]
Updating country info : [========================================]
Set Administrator password:
Re-enter Administrator password:
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/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 26, in new_site
verbose=verbose, install_apps=install_app, source_sql=source_sql, force=force)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 61, in _new_site
_install_app(app, verbose=verbose, set_as_patched=not source_sql)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/installer.py”, line 146, in install_app
frappe.get_attr(after_install)()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/install.py”, line 37, in after_install
update_password(“Administrator”, get_admin_password())
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/password.py”, line 57, in update_password
{ ‘doctype’: doctype, ‘name’: user, ‘fieldname’: fieldname, ‘pwd’: pwd, ‘salt’: salt })
File “/home/spoojary/frappe-bench/apps/frappe/frappe/database.py”, line 138, in sql
self._cursor.execute(query, values)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (2006, ‘MySQL server has gone away’)

Is there any command to uninstall the bench and start from scratch?

I think you just need to delete the frappe-bench directory.

Thanks, I removed the directory and started the installation again. However installing erpnext on new site failed. Wondering whether removing the directory alone isn’t sufficient. Are the database files stored within frappe-bench?

spoojary@spoojary-home:~/frappe-bench $ bench --site site.skpi install-app erpnext
Installing erpnext…
Updating DocTypes for erpnext : [== ]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/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 153, in install_app
_install_app(app, verbose=context.verbose)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/installer.py”, line 134, in install_app
sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/sync.py”, line 45, in sync_for
reset_permissions=reset_permissions)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 58, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 129, in import_doc
doc.insert()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 220, in insert
self.run_post_save_methods()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 788, in run_post_save_methods
self.run_method(“on_update”)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 667, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 888, in composer
return composed(self, method, *args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 871, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 661, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 205, in on_update
self.run_module_method(“on_doctype_update”)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 254, in run_module_method
module = load_doctype_module(self.name, self.module)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 184, in load_doctype_module
raise ImportError, ‘Module import failed for {0} ({1})’.format(doctype, module_name)
ImportError: Module import failed for Payment Request (erpnext.accounts.doctype.payment_request.payment_request)
spoojary@spoojary-home:~/frappe-bench $
spoojary@spoojary-home:~/frappe-bench $
spoojary@spoojary-home:~/frappe-bench $ bench --site site.skpi install-app erpnext
Installing erpnext…
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/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/spoojary/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/spoojary/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/spoojary/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/commands/site.py”, line 153, in install_app
_install_app(app, verbose=context.verbose)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/installer.py”, line 132, in install_app
add_module_defs(name)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/installer.py”, line 328, in add_module_defs
d.save(ignore_permissions=True)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 231, in save
return self._save(*args, **kwargs)
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 254, in _save
self.insert()
File “/home/spoojary/frappe-bench/apps/frappe/frappe/model/document.py”, line 208, in insert
raise e
frappe.exceptions.DuplicateEntryError: (u’Module Def’, u’Accounts’, IntegrityError(1062, “Duplicate entry ‘Accounts’ for key ‘PRIMARY’”))

For what its worth, I continued to hit the same error on ‘bench update’ again. So removed the site using drop-site and recreated. This time ran ‘bench update’ after each command to check which step is introducing this error. Strangely, the error didn’t come back. Looks like the code has its own mind :slight_smile: