[Important] Error in Bench Update?

Hi everyone,

Due to a recent change in how versioning is handled for frappe apps, bench update will break. If you get an error like:

  File "/home/travis/bench-repo/bench/app.py", line 132, in get_current_frappe_version
    return get_major_version(get_current_version('frappe', bench=bench))
  File "/home/travis/bench-repo/bench/app.py", line 152, in get_current_version
    return get_version_from_string(f.read())
  File "/home/travis/bench-repo/bench/app.py", line 240, in get_version_from_string
    return match.group(2)
AttributeError: 'NoneType' object has no attribute 'group'

Do the following:

  1. Go to bench-repo folder
  2. git pull origin
  3. Go back to frappe-bench folder
  4. Run bench update

If you are develop branch, you might be asked to run bench update --upgrade. This is because we have changed the version of frappe and erpnext in the develop branch to v7.0.0-beta

Best,
Anand.

14 Likes

Hi there,

i’ve installed develop version on CentOS, followed your instruction but still getting the error:

Traceback (most recent call last):
File “/usr/bin/bench”, line 9, in
load_entry_point(‘bench==3.0.0’, ‘console_scripts’, ‘bench’)()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2566, in load_entry_point
return ep.load()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2260, in load
entry = import(self.module_name, globals(),globals(), [‘name’])
File “/home/frappe/bench-repo/bench/cli.py”, line 3, in
from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe
File “/home/frappe/bench-repo/bench/utils.py”, line 622, in
FRAPPE_VERSION = get_current_frappe_version()
File “/home/frappe/bench-repo/bench/utils.py”, line 467, in get_current_frappe_version
from .app import get_current_frappe_version as fv
File “/home/frappe/bench-repo/bench/app.py”, line 264, in
FRAPPE_VERSION = get_current_frappe_version()
File “/home/frappe/bench-repo/bench/app.py”, line 132, in get_current_frappe_version
return get_major_version(get_current_version(‘frappe’, bench=bench))
File “/home/frappe/bench-repo/bench/app.py”, line 158, in get_current_version
return get_version_from_string(f.read())
File “/home/frappe/bench-repo/bench/app.py”, line 246, in get_version_from_string
return match.group(2)
AttributeError: ‘NoneType’ object has no attribute ‘group’

This error is still occuring after following @anand steps. Any update on this?

xn@xn-backup:~/frappe-bench$ bench update
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2569, in load_entry_point
return ep.load()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2229, in load
return self.resolve()
File “/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/home/xn/bench-repo/bench/cli.py”, line 3, in
from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe
File “/home/xn/bench-repo/bench/utils.py”, line 622, in
FRAPPE_VERSION = get_current_frappe_version()
File “/home/xn/bench-repo/bench/utils.py”, line 467, in get_current_frappe_version
from .app import get_current_frappe_version as fv
File “/home/xn/bench-repo/bench/app.py”, line 264, in
FRAPPE_VERSION = get_current_frappe_version()
File “/home/xn/bench-repo/bench/app.py”, line 132, in get_current_frappe_version
return get_major_version(get_current_version(‘frappe’, bench=bench))
File “/home/xn/bench-repo/bench/app.py”, line 158, in get_current_version
return get_version_from_string(f.read())
File “/home/xn/bench-repo/bench/app.py”, line 246, in get_version_from_string
return match.group(2)
AttributeError: ‘NoneType’ object has no attribute ‘group’

@anand I have the same problem, I cant able to up my system, pls post a fix soon.

@JoEz @mrmo @hereabdulla

Hi, the issue has been completely resolved. Just run:

git fetch
git pull

in bench-repo

5 Likes

Confirmed, all works now, thanks.

@vjFaLk solved, thx!

Found another issue after git fetch, pull & bench switch-to-master.
It will add new redis-queue.conf and binding port 6379 for localhost.
It cause cannot bench start.

Remove redis variables from common_site_config.json

Then run
bench setup redis

@vjFaLk got an error on bench update on Centos 7 develop branch

fatal: index file smaller than expected
Command “git fetch -q” failed with error code 128 in /home/frappe/frappe-bench/env/src/pdfkit
Traceback (most recent call last):
File “/usr/bin/bench”, line 9, in
load_entry_point(‘bench==4.0.0-beta’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/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/frappe/bench-repo/bench/commands/update.py”, line 79, in _update
update_requirements(bench=bench_path)
File “/home/frappe/bench-repo/bench/utils.py”, line 372, in update_requirements
exec_cmd(“{pip} install -q -r {req_file}”.format(pip=pip, req_file=req_file))
File “/home/frappe/bench-repo/bench/utils.py”, line 100, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/frappe/requirements.txt

Can you please check?

Thz

I confirm it works too. Thank you.

@anand I tried everything, but cant get rid of this error.

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.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 49, in update
version_upgrade = is_version_upgrade()
File “/home/ubuntu/bench-repo/bench/app.py”, line 102, in is_version_upgrade
upstream_version = get_upstream_version(‘frappe’, bench=bench, branch=branch)
File “/home/ubuntu/bench-repo/bench/app.py”, line 156, in get_upstream_version
return get_version_from_string(contents)
File “/home/ubuntu/bench-repo/bench/app.py”, line 212, in get_version_from_string
return match.group(2)
AttributeError: ‘NoneType’ object has no attribute ‘group’

any help? My setup is in ubuntu 14.04, I have done fetch, pull in bench-repo…

@JoEz Can you try running the below commands :

rm .git/index
git reset HEAD .

1 Like

@vjFaLk ok, thx

@kirthi

Try going into bench-repo and do the below commands :

git fetch
git reset --hard origin/master

@vjFaLk got an error on bench update

Command “/home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-kKRESo/cffi/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-fsowzS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python2.7/cffi” failed with error code 1 in /tmp/pip-build-kKRESo/cffi/
Traceback (most recent call last):
File “/usr/bin/bench”, line 9, in
load_entry_point(‘bench==4.0.0-beta’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/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/frappe/bench-repo/bench/commands/update.py”, line 79, in _update
update_requirements(bench=bench_path)
File “/home/frappe/bench-repo/bench/utils.py”, line 371, in update_requirements
exec_cmd(“{pip} install -q -r {req_file}”.format(pip=pip, req_file=req_file))
File “/home/frappe/bench-repo/bench/utils.py”, line 99, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/frappe/requirements.txt

Can u please check?

1 Like

@vjFaLk
I got same issue as @JoEz, and your tip couldn’t work, please see detail as below:

`mksimple@lab9:~/bench-repo$ vi .git/index
mksimple@lab9:~/bench-repo$
mksimple@lab9:~/bench-repo$
mksimple@lab9:~/bench-repo$ rm .git/index
mksimple@lab9:~/bench-repo$ git reset HEAD .
mksimple@lab9:~/bench-repo$ cd …
mksimple@lab9:~$ cd frappe-bench/
mksimple@lab9:~/frappe-bench$ bench update --upgrade
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 GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch develop → FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
  • branch develop → FETCH_HEAD
    Already up-to-date.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Command “/var/service/www/nginx/marketsimple.com/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-GabF6A/cffi/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-QxGhVU-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/service/www/nginx/marketsimple.com/frappe-bench/env/include/site/python2.7/cffi” failed with error code 1 in /tmp/pip-build-GabF6A/cffi/
    Traceback (most recent call last):
    File “/usr/local/bin/bench”, line 9, in
    load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
    File “/var/service/www/nginx/marketsimple.com/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 “/var/service/www/nginx/marketsimple.com/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 “/var/service/www/nginx/marketsimple.com/bench-repo/bench/commands/update.py”, line 79, in _update
    update_requirements(bench=bench_path)
    File “/var/service/www/nginx/marketsimple.com/bench-repo/bench/utils.py”, line 371, in update_requirements
    exec_cmd(“{pip} install -q -r {req_file}”.format(pip=pip, req_file=req_file))
    File “/var/service/www/nginx/marketsimple.com/bench-repo/bench/utils.py”, line 100, in exec_cmd
    raise CommandFailedError(cmd)
    bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/frappe/requirements.txt
    mksimple@lab9:~/frappe-bench$`

Hello All,

I am on master branch when i run bench update i am getting “_mysql_exceptions.OperationalError: (1048, “Column ‘image_view’ cannot be null”)” while runnng patch “erpnext.patches.v4_2.repost_reserved_qty”

Please suggest.

@vjFaLk still the same…

ubuntu@ecapsuleqa6:~/bench-repo$ git fetch
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps
4a9933f…253f72f develop → origin/develop
ubuntu@ecapsuleqa6:~/bench-repo$ git reset --hard origin/master
HEAD is now at 494177d [fix] reload bench utils and bench app
ubuntu@ecapsuleqa6:~/bench-repo$ cd
ubuntu@ecapsuleqa6:~$ cd frappe-bench/
ubuntu@ecapsuleqa6:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.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 49, in update
version_upgrade = is_version_upgrade()
File “/home/ubuntu/bench-repo/bench/app.py”, line 102, in is_version_upgrade
upstream_version = get_upstream_version(‘frappe’, bench=bench, branch=branch)
File “/home/ubuntu/bench-repo/bench/app.py”, line 156, in get_upstream_version
return get_version_from_string(contents)
File “/home/ubuntu/bench-repo/bench/app.py”, line 212, in get_version_from_string
return match.group(2)
AttributeError: ‘NoneType’ object has no attribute ‘group’