What is the proper production update/upgrade method?

Whenever I type “bench update” in the frappe user folder I get error upon error. I’m on:

bench 4.1.0
erpnext 7.0.29
frappe 7.0.30

This has been an issue for my company as well.

It’s been working rather well for me (knock on wood). What kind of errors are you getting… ? Maybe 1or 2 issues causing most of the problem,

Git errors are the most common. Usually saying something about changed files – which I’ve never changed.

INFO:bench.utils:updating bench
Already up-to-date.
remote: Counting objects: 62, done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 62 (delta 24), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (62/62), done.
From https://github.com/frappe/frappe
   ed63eb9..add9c74  develop    -> upstream/develop
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
remote: Counting objects: 94, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 94 (delta 58), reused 53 (delta 53), pack-reused 27
Unpacking objects: 100% (94/94), done.
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
   51a236f..94dbc14  master     -> upstream/master
Updating b8a8fb5..94dbc14
error: Your local changes to the following files would be overwritten by merge:
        erpnext/__init__.py
        erpnext/accounts/doctype/budget/budget.json
        erpnext/accounts/doctype/budget/budget.py
        erpnext/accounts/doctype/cost_center/cost_center.js
        erpnext/accounts/doctype/sales_invoice/pos.py
        erpnext/accounts/doctype/sales_invoice/sales_invoice.json
        erpnext/accounts/doctype/sales_invoice/sales_invoice.py
        erpnext/accounts/page/pos/pos.js
        erpnext/accounts/report/accounts_receivable/accounts_receivable.py
        erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
        erpnext/controllers/status_updater.py
        erpnext/controllers/stock_controller.py
        erpnext/controllers/taxes_and_totals.py
        erpnext/hr/doctype/employee/employee_list.js
        erpnext/hr/doctype/process_payroll/process_payroll.py
        erpnext/manufacturing/doctype/operation/operation.py
        erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json
        erpnext/patches.txt
        erpnext/patches/v7_0/calculate_total_costing_amount.py
        erpnext/patches/v7_0/convert_timelog_to_timesheet.py
        erpnext/patches/v7_0/create_warehouse_nestedset.py
        erpnext/patches/v7_0/migrate_schools_to_erpnext.py
        erpnext/patches/v7_0/repost_future_gle_for_purchase_invoice.py
        erpnext/portal/doctype/homepage/homepage.json
        erpnext/portal/doctype/homepage/homepage.py
        erpnext/projects/doctype/timesheet/timesheet.json
        erpnext/public/js/controllers/taxes_and_totals.js
        erpnext/public/js/payment/payment_details.html
        erpnext/public/js/payment/payments.js
        erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.json
        erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py
        erpnext/selling/sales_common.js
        erpnext/stock/doctype/delivery_note/delivery_note.js
        erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
        erpnext/support/page/support_analytics/support_analytics.js
        erpnext/templates/pages/home.html
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/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/frappe/.bench/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/bench/commands/update.py", line 76, in _update
    pull_all_apps(bench_path=bench_path)
  File "/home/frappe/.bench/bench/app.py", line 140, in pull_all_apps
    remote=remote, branch=get_current_branch(app, bench_path=bench_path)), cwd=app_dir)
  File "/home/frappe/.bench/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull  upstream master

Take a look at this post to clean up the git stuff:

Even though the title is debian, it’s about fixing git, which is distro independent.

Let us know if it helps with the errors.

Update: this didn’t work. Still getting Git errors. Also had to reinstall bench.

@chrsfr Did you make some changes to the code?

To fix the issue you run these commands within the frappe and erpnext app folders :

git reset --hard
git clean -fdx
git checkout master
git pull

@rmehta @shreyasp

I’ve been noticing this issue in several places, where somehow files in the frappe/erpnext app end up getting modified. Any ideas why this could possibly be happening?

@vjFaLk I haven’t modified any code. I primarily use the web interface for erpnext and some API usage for newsletters.

Update: I’ve followed the Git instructions above. I’m getting a different error now while running “bench update”

~/frappe-bench$ 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.
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-RGOP2s/frappe/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/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/frappe/.bench/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/bench/commands/update.py", line 79, in _update
    update_requirements(bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 375, in update_requirements
    install_requirements(pip, req_file)
  File "/home/frappe/.bench/bench/utils.py", line 379, in install_requirements
    exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
  File "/home/frappe/.bench/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/erpnext/requirements.txt

Update update: Running “bench retry-upgrade” after performing the Git fixes ran successfully. Only running “bench update” still shows the error above/

1 Like

I had a clean install frappe/erpnext, but still had exact the same problem.
But it seems this is an error in the system, as we all have the same error, and as such it should be fixed in the code.

I used following suggestions (thanks guys!)

@vjFaLk:

To fix the issue you run these commands within the frappe and erpnext app folders :

git reset --hard
git clean -fdx
git checkout master
git pull

@chrsfr:

Update update: Running “bench retry-upgrade” after performing the Git fixes ran successfully. Only running “bench update” still shows the error above/

When the script asked to overwrite nginx.conf and supervisor.conf, I did so (after backing up the .conf files!)
and then restarted nginx and supervisorctl, to get the version updated.