"bench update" error

Hi I’m trying to run “bench update” on my ERPNext install. It doesn’t seem to be working and is giving this error:

bench update
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/ubuntu/bench-repo/bench/cli.py", line 60, in cli
    bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/bench-repo/bench/cli.py", line 211, in _update
    version_upgrade = is_version_upgrade()
  File "/home/ubuntu/bench-repo/bench/app.py", line 94, in is_version_upgrade
    upstream_version = get_upstream_version('frappe', bench=bench, branch=branch)
  File "/home/ubuntu/bench-repo/bench/app.py", line 137, in get_upstream_version
    return get_version_from_string(contents)
  File "/home/ubuntu/bench-repo/bench/app.py", line 193, in get_version_from_string
    return match.group(2)
AttributeError: 'NoneType' object has no attribute 'group'

This seems to want to switch me to version 7. Has that been released/deemed stable officially yet?

This is from the erpnext email I receive : Hello Friends,
ERPNext Version 7 is here!

Your favorite ERP system just got a major upgrade. Key features include:
Offline Point-of-Sale
Payment Entry
Timesheets
Asset Depreciation
Budgeting Redesign
You can learn more about version 7 by trying out a new account on https://erpnext.com

If you are an existing subscriber, we will start migrating your accounts in a couple of weeks time. If you want to move to Version 7 faster, just drop us a mail at support@erpnext.com

Here what I would suggest you update but keep a backup :wink:

It has failed yet again. :confused:

$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied (use --upgrade to upgrade): Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling paypal_integration
From https://github.com/frappe/paypal_integration
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
Migrating site1.local
Executing frappe.patches.v6_24.sync_desktop_icons in site1.local (1bd3e0294d)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, 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/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/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/ubuntu/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/ubuntu/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/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/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/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 206, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/patches/v6_24/sync_desktop_icons.py", line 13, in execute
    modules_list += sync_from_app(app)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/desk/doctype/desktop_icon/desktop_icon.py", line 317, in sync_from_app
    desktop_icon.save()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 242, in save
    return self._save(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 259, in _save
    self.insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 213, in insert
    self._validate()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 388, in _validate
    self._validate_links()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 630, in _validate_links
    frappe.LinkValidationError)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 299, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red')
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 292, in msgprint
    _raise_exception()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 265, in _raise_exception
    raise raise_exception, encode(msg)
frappe.exceptions.LinkValidationError: Could not find _doctype: Student
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.0.0', 'console_scripts', 'bench')()
  File "/home/ubuntu/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/bench-repo/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
  File "/home/ubuntu/bench-repo/bench/commands/update.py", line 90, in _update
    patch_sites(bench_path=bench_path)
  File "/home/ubuntu/bench-repo/bench/utils.py", line 164, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
  File "/home/ubuntu/bench-repo/bench/utils.py", line 501, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

sudo apt-get install libffi-dev

And if it fail again I<m out of idea :wink:

No idea. I’m doing a fresh install on a different sever. Thanks for your help though!

@chrsfr I will not recommend it to everyone, but just to pass your update and bring system back online, do remove following line from /home/frappe/frappe-bench/apps/frappe/frappe/patches.txt

Login to frappe user command: sudo su - frappe

$ sed -i.backup '/frappe.patches.v6_24.sync_desktop_icons/d' /home/frappe/frappe-bench/apps/frappe/frappe/patches.txt
$ bench update --upgrade

Now sed command will remove line from the file patches.txt by creating a backup file with patches.txt.backup.

Make sure to remove or move somewhere safe this backup file and do

$ cd /home/frappe/frappe-bench/apps/frappe && git reset --hard

before performing bench update next time.

1 Like

Steps to upgrade

  1. cd bench-repo
  2. git fetch
  3. git pull

upgrade nodejs

  1. sudo npm cache clean -f
  2. sudo npm install -g n
  3. sudo n stable

final step
bench update --upgrade

can’t upgrade for this error

Traceback (most recent call last):
File “/home/naztech/.local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/naztech/bench/bench/cli.py”, line 40, in cli
bench_command()
File “/home/naztech/.local/lib/python2.7/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/naztech/.local/lib/python2.7/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/naztech/.local/lib/python2.7/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/naztech/.local/lib/python2.7/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/naztech/.local/lib/python2.7/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/naztech/bench/bench/commands/update.py”, line 138, in switch_to_branch
switch_to_branch(branch=branch, apps=list(apps), upgrade=upgrade)
File “/home/naztech/bench/bench/app.py”, line 397, in switch_to_branch
switch_branch(branch, apps=apps, bench_path=bench_path, upgrade=upgrade)
File “/home/naztech/bench/bench/app.py”, line 383, in switch_branch
update_requirements()
File “/home/naztech/bench/bench/utils.py”, line 443, in update_requirements
install_app(app, bench_path=bench_path)
File “/home/naztech/bench/bench/app.py”, line 172, in install_app
find_links=find_links))
File “/home/naztech/bench/bench/utils.py”, line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -e ./apps/erpnext

@Kamrul.Hasan

Use the below command from frappe-bench

./env/bin/pip install -e apps/erpnext

~/frappe-bench$ ./env/bin/pip install -e apps/erpnext
Obtaining file:///home/naztech/frappe-bench/apps/erpnext
ERROR: Command errored out with exit status 1:
command: /home/naztech/frappe-bench/env/bin/python3 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/home/naztech/frappe-bench/apps/erpnext/setup.py’“'”‘; file=’“'”‘/home/naztech/frappe-bench/apps/erpnext/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’“‘))’ egg_info
cwd: /home/naztech/frappe-bench/apps/erpnext/
Complete output (1 lines):
error in erpnext setup command: ‘install_requires’ must be a string or list of strings containing valid project/version requirement specifiers; Invalid requirement, parse error at “”'git+htt”"
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.