Unable to do bench update

I tried to update the bench but was not successful .Any help would be appreciated as in a desperate situation stuck up in the setting up the company can;t proceed.
[frappe@localhost 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
Updating 9f93076..c0edd95
error: Your local changes to the following files would be overwritten by merge:
frappe/init.py
frappe/desk/doctype/bulk_update/bulk_update.js
frappe/integration_broker/doctype/integration_service/integration_service.js
frappe/integrations/doctype/dropbox_settings/dropbox_settings.js
frappe/integrations/doctype/paypal_settings/paypal_settings.py
frappe/model/db_schema.py
frappe/public/css/form_grid.css
frappe/public/css/list.css
frappe/public/less/form_grid.less
frappe/public/less/list.less
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
File "/usr/bin/bench", line 11, in <module>
load_entry_point('bench', 'console_scripts', 'bench')()
File "/home/frappe/.bench/bench/cli.py", line 40, in cli
bench_command()
File "/usr/lib64/python2.7/site-packages/click/core.py", line 716, in call
return self.main(*args, **kwargs)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/lib64/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib64/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib64/python2.7/site-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
[frappe@localhost frappe-bench]$
  • Later on deleted the files

frappe/init.py

frappe/desk/doctype/bulk_update/bulk_update.js

frappe/integration_broker/doctype/integration_service/integration_service.js

frappe/integrations/doctype/dropbox_settings/dropbox_settings.js

frappe/integrations/doctype/paypal_settings/paypal_settings.py

frappe/model/db_schema.py

frappe/public/css/form_grid.css

frappe/public/css/list.css

frappe/public/less/form_grid.less

frappe/public/less/list.less

Then cd …/ to frappe-bench then git pull then bench update

  • after deleting the files

when i did benchupdate i receive the following error.

frappe@localhost frappe-bench]$ bench update

INFO:bench.utils:updating bench

Already up-to-date.

Traceback (most recent call last):

File “/usr/bin/bench”, line 11, in

load_entry_point('bench', 'console_scripts', 'bench')()

File “/home/frappe/.bench/bench/cli.py”, line 40, in cli

bench_command()

File “/usr/lib64/python2.7/site-packages/click/core.py”, line 716, in call

return self.main(args, *kwargs)

File “/usr/lib64/python2.7/site-packages/click/core.py”, line 696, in main

rv = self.invoke(ctx)

File “/usr/lib64/python2.7/site-packages/click/core.py”, line 1060, in invoke

return process_result(sub_ctx.command.invoke(sub_ctx))

File “/usr/lib64/python2.7/site-packages/click/core.py”, line 889, in invoke

return ctx.invoke(self.callback, *ctx.params)

File “/usr/lib64/python2.7/site-packages/click/core.py”, line 534, in invoke

return callback(args, **kwargs)

File “/home/frappe/.bench/bench/commands/update.py”, line 49, in update

version_upgrade = is_version_upgrade()

File “/home/frappe/.bench/bench/app.py”, line 155, in is_version_upgrade

local_version = get_major_version(get_current_version(app, bench_path=bench_path))

File “/home/frappe/.bench/bench/app.py”, line 197, in get_current_version

with open(os.path.join(repo_dir, os.path.basename(repo_dir), '__init_.py')) as f:

IOError: [Errno 2] No such file or directory: ‘./apps/frappe/frappe/init.py’

[frappe@localhost frappe-bench]$

You shouldn’t delete files when there is a conflict.
Try git checkout master in your frappe-bench/apps/frappe directory.

Sorry, I suggested to @osmanahmed to delete all files as a quick cure-all to a non functioning fresh install. But @netchampfaris is totally correct, git checkout master is the right way to do this.
But @osmanahmed sounded in a rush and as a quick (and nasty) way to get up and running I stand by the idea of just deleting the existing files and starting again. So technically a bit heavy handed try this below:
cd /home/frappe/frappe-bench/apps/frappe/
And delete all files within the /frappe/ folder with:
sudo rm -r frappe
Then
git pull
Then
cd /home/frappe/bench-repo/bench/
sudo rm -r bench
Then
git pull
Then
cd /home/frappe/frappe-bench/
bench update

This will delete all previously downloaded files for bench and frappe and download all the latest files from github.
cd /home/frappe/frappe-bench/
Is where you execute all bench commands. All commands can be seen with bench --help

HTH

Thank You @netchampfaris @System19 for your response.

  • I tried to go for git checkout master and below is the repository .Due to the character restraints i am unable to paste you the complete repository.But in the end the following is the message.

Already on ‘master’
Your branch is behind ‘upstream/master’ by 14 commits, and can be fast-forwarded.
(use “git pull” to update your local branch)
[frappe@localhost frappe]$

Do a git pull as it says

I tried git pull

again i am back with

[frappe@localhost frappe]$ git pull
Updating 9f93076…c0edd95
error: Your local changes to the following files would be overwritten by merge:
frappe/init.py
frappe/desk/doctype/bulk_update/bulk_update.js
frappe/integration_broker/doctype/integration_service/integration_service.js
frappe/integrations/doctype/dropbox_settings/dropbox_settings.js
frappe/integrations/doctype/paypal_settings/paypal_settings.py
frappe/model/db_schema.py
frappe/public/css/form_grid.css
frappe/public/css/list.css
frappe/public/less/form_grid.less
frappe/public/less/list.less
Please, commit your changes or stash them before you can merge.
Aborting

Did you do any changes? If yes, do you want to save them?

No changes were done from my end.

Then do, git checkout frappe/

I did, git checkout frappe

[frappe@localhost frappe]$ git checkout
M .gitignore
M .travis.yml
M CONTRIBUTING.md
M MANIFEST.in
M README.md
M attributions.md
M ci/my_config.h.patch
M hooks.md
M license.txt
M requirements.txt
M setup.py
M socketio.js
M test_sites/apps.txt
M test_sites/test_site/site_config.json
Your branch is behind ‘upstream/master’ by 14 commits, and can be fast-forwarded.
(use “git pull” to update your local branch)

[frappe@localhost frappe]$ git checkout frappe
[frappe@localhost frappe]$ git checkout frappe/

@System19
i performed the mentioned steps where deleting frappe cd /home/frappe/frappe-bench/apps/frappe/
performed git pull

-i cannot find the following directory
cd /home/frappe/bench-repo/bench/

but still just removing the frappe i tried to do git pull and then bench update .The following is the output

bench update
INFO:bench.utils:updating bench
Already up-to-date.
Traceback (most recent call last):
File “/usr/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/lib64/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib64/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib64/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib64/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib64/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/.bench/bench/commands/update.py”, line 49, in update
version_upgrade = is_version_upgrade()
File “/home/frappe/.bench/bench/app.py”, line 155, in is_version_upgrade
local_version = get_major_version(get_current_version(app, bench_path=bench_path))
File “/home/frappe/.bench/bench/app.py”, line 197, in get_current_version
with open(os.path.join(repo_dir, os.path.basename(repo_dir), ‘init.py’)) as f:
IOError: [Errno 2] No such file or directory: ‘./apps/frappe/frappe/init.py’
[frappe@localhost frappe-bench]$

[frappe@localhost 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
    remote: Counting objects: 174, done.
    remote: Total 174 (delta 118), reused 118 (delta 118), pack-reused 56
    Receiving objects: 100% (174/174), 1.49 MiB | 801.00 KiB/s, done.
    Resolving deltas: 100% (128/128), completed with 54 local objects.
    From https://github.com/frappe/erpnext
  • branch master -> FETCH_HEAD
    Updating 44281b7…51eed9a
    error: Your local changes to the following files would be overwritten by merge:
    erpnext/init.py
    erpnext/accounts/doctype/journal_entry/journal_entry.py
    erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
    erpnext/accounts/page/pos/pos.js
    erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
    erpnext/demo/setup/manufacture.py
    erpnext/demo/setup/setup_data.py
    erpnext/demo/user/stock.py
    erpnext/docs/assets/img/accounts/pos-item.png
    erpnext/docs/assets/img/accounts/pos-payment.png
    erpnext/docs/user/manual/en/accounts/articles/index.txt
    erpnext/docs/user/manual/en/accounts/point-of-sale-pos-invoice.md
    erpnext/docs/user/manual/en/accounts/pricing-rule.md
    erpnext/docs/user/manual/en/selling/articles/adding-margin.md
    erpnext/docs/user/videos/index.md
    erpnext/patches.txt
    erpnext/setup/setup_wizard/data/country_wise_tax.json
    erpnext/setup/setup_wizard/setup_wizard.py
    erpnext/stock/doctype/item/item.py
    erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
    erpnext/stock/doctype/stock_entry/stock_entry.py
    Please, commit your changes or stash them before you can merge.
    Aborting
    Traceback (most recent call last):
    File “/usr/bin/bench”, line 11, in
    load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
    File “/home/frappe/.bench/bench/cli.py”, line 40, in cli
    bench_command()
    File “/usr/lib64/python2.7/site-packages/click/core.py”, line 716, in call
    return self.main(*args, **kwargs)
    File “/usr/lib64/python2.7/site-packages/click/core.py”, line 696, in main
    rv = self.invoke(ctx)
    File “/usr/lib64/python2.7/site-packages/click/core.py”, line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/usr/lib64/python2.7/site-packages/click/core.py”, line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/usr/lib64/python2.7/site-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

Just like frappe app you have changes in erpnext too.
If you don’t need your changes, run
cd /to/your/erpnext/folder git checkout erpnext/

Learn about basic git commands like git pull, git checkout, etc.Then, you’ll be able to identify your problem. Start here