Upgrade Error going from v8 to v9 ERPNext

I really do not understand the issue here. I have been running a fresh ERPNext instance since September 13th and have run migrated it as early as today using the following command:

bench --site site1.local migrate

So, This afternoon I attempted the upgrade using this command:

bench update --upgrade

This is the resulting error:


erp_jmi@erp-upgrade-test:/home/frappe/frappe-bench$ sudo bench update --upgrade
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 7 (delta 6), reused 6 (delta 5), pack-reused 0
Unpacking objects: 100% (7/7), done.
From GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps
7a7c611ā€¦e79d722 master ā†’ origin/master
Updating 7a7c611ā€¦e79d722
Fast-forward
bench/commands/setup.py | 5 ++Ā±-
bench/config/production_setup.py | 6 ++Ā±ā€“
2 files changed, 6 insertions(+), 5 deletions(-)
remote: Counting objects: 1740, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 1740 (delta 1186), reused 1191 (delta 1186), pack-reused 546
Receiving objects: 100% (1740/1740), 1.38 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1431/1431), completed with 346 local objects.
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript
87d5c07ā€¦645526b master ā†’ upstream/master

  • [new branch] bcornwellmott-patch-2 ā†’ upstream/bcornwellmott-patch-2
    1d2525dā€¦133f4b4 develop ā†’ upstream/develop
    87d5c07ā€¦645526b hotfix ā†’ upstream/hotfix
    c1649a4ā€¦645526b staging ā†’ upstream/staging
  • [new tag] v9.0.0 ā†’ v9.0.0
  • [new tag] v8.10.6 ā†’ v8.10.6
  • [new tag] v8.10.7 ā†’ v8.10.7
  • [new tag] v8.10.8 ā†’ v8.10.8
  • [new tag] v8.10.9 ā†’ v8.10.9
    INFO:bench.utils:./env/bin/pip install Pillow
    Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
    Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
    Cannot proceed with update: You have local changes in app ā€œfrappeā€ that are not committed.
    Here are your choices:
  1. Merge the frappe app manually with ā€œgit pullā€ / ā€œgit pull --rebaseā€ and fix conflicts.
  2. Temporarily remove your changes with ā€œgit stashā€ or discard them completely
    with ā€œbench update --resetā€ or for individual repositries ā€œgit reset --hardā€
  3. If your changes are helpful for others, send in a pull request via GitHub and
    wait for them to be merged in the core.
    erp_jmi@erp-upgrade-test:/home/frappe/frappe-bench$

I have not made any ā€œchangesā€ to the frappe application. I have only entered data into the ERPNext system. How do I get specific information on what this error is calling changes?

I am not a developer, and this is a production installation I am trying to upgrade. I made a copy of the VM instance and tried it first on the copy so I do not trash my live data. The message above is the result.

I am currently on ERPNext version 8.11.2
and Frappe version 8.10.5

I have also tried the suggested ā€œbench update --resetā€ and it came back with the following response:

erp_jmi@erp-upgrade-test:/home/frappe/frappe-bench$ sudo bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
()
()
This update will cause a major version change in Frappe/ERPNext from 8 to 9.
This would take significant time to migrate and might break custom apps. Please run bench update --upgrade to
confirm.
()
You can stay on the latest stable release by running bench switch-to-master or pin your bench to 8 by running
bench switch-to-v8
erp_jmi@erp-upgrade-test:/home/frappe/frappe-bench$

Running the bunsh update --upgrade after that still has the same error as before.

So what should be my next step?

BKM

This really is the THE biggest problem with ERPNext. It seems impossible to take a production version that has live data in it and upgrade it wi the next major version. I never got version 7 to upgrade to version 8 and had to start with a fresh version 8 system and import all of my data. I was getting the exact same errors back then as well. the system claiming that I had made local changes to frappe when I never had done any such thing.

And now here we are again with the same errors going from version 8 to version 9.

Very frustrating.

BKM

2 Likes

If you have not made any changes, try: bench update --reset

Also, in the newer version you would have bench manager, a tool from within the web which would help you manage this better.

Yupā€¦ If you read the whole post above you would also see the bench update --reset that I tried and the dismal result of that as well.

I did not know anything about a bench manager, but if I cannot get the system to upgrade to the newer version then how would that ever help me?

BKM

What kinds of things exactly constitute ā€œchangesā€ top the frappe app?

Does simply entering data in the ERPNExt system constitute changes?

I am lost even trying to understand what these changes could possibly be.

BKM

The ā€˜git statusā€™ command should shed some light on these mysterious changes.
Can you try executing commands in the frappe folder as shown in the screenshot:

frappe_changes

Changes, if any will appear in red.

@bkm I have simple solution for you.
I some time we donā€™t change the file but git show unchanged file because out bench change them.

Solution

remove frappe folder from apps folder.
and simple get frappe from github just run the commend

cd ~/your_bench_init_directory Ex.[frappe-bench]
bench get-app https://gitub.com/frappe/frappe --branch master

same think for erpnext.
and then run migrate.

Thanks.

1 Like

Ok, I ran the ā€˜git statusā€™ command and the result is overwhelming. It appears as if every single file in the system claims to be changed.

The result is over 2000 lines that begin with ā€œmodified:ā€ in the terminal output!!! I cannot even upload it here. The forum only allows uploads of picture files. In order to capture everything I had to use the command:

git status > tracetxt.txt

That saved all of the output to text file and it is huge!

Now I am really stumped. Why would the system think that every file in the system has changed?

BKM

Wouldnā€™t this overwrite my databases as well? If not then how would the databases be upgraded in the process?

I have a production system and am running live data.

BKM

I ran in to the same issue and the Solution for me was:

cd /home/frappe/frappe-bench/apps/frappe
git stash

cd /home/frappe/frappe-bench/apps/erpnext
git stash

cd /home/frappe/frappe-bench/
bench update --upgrade

that works for me

@bkm I have asked the exact same questions before. Why is the upgrade path so difficult! Once setup the software is easy to use and setup but not everyone is a programmer and having detailed documentation on upgrade process will eliminate a lot of questions here.

Sometimes if you do a fresh system install without even completing the setup and you try to upgrade it gives error that files have been changed. From experience I try all the commands to stash and reset (I donā€™t know what they do). On production environment I never run upgrade due to the above reasons. I always complete a fresh install and restore database and files. I had a lot of issues with that as well last time but the team here fixed the errors in the code.

Consultants should be able to install and upgrade the package and developers change and customise. It seems for ERPNext you need to know how to code just to perform an upgrade to the very next version. Looking forward to bench manager in V9 and see how that helps moving forward.

If you havenā€™t made any changes I would suggest a slight variation on what @sione mentions:

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

cd /home/frappe/frappe-bench/apps/erpnext
git reset --hard

cd /home/frappe/frappe-bench/
bench update --upgrade

This gives you a fresh git pull. Once upgrade is completed I normally do
sudo service nginx reload
sudo supervisorctl restart all
To refresh everything.

1 Like

As I mention on another post
When doing the Ver 8 to 9 upgrade on a live production instance you will be prompted near the end of the process:
Your bench was upgraded to version 9
supervisor.conf already exists and this will overwrite it. Do you want to continue? [y/N]:
Choose n
You will then see
Aborted!
Ver 9 is now live. As @felix mentions above Take a back up first.

@sione
@System19

Well, I thought about doing the ā€˜git stashā€™ in those directories to get past the problems until I did the ā€˜git statusā€™ in the apps/frappe directory and got over 2000 lines of modified files!! Doing git stash would essentially cause the update to ignore every file in the system. I canā€™t imagine that working out very well.

The ā€˜git reset --hardā€™ may have some affect, but I just cannot believe that there are over 2000 lines of modifications that the upgrade complained about. I could see maybe 10 to 15 lines, but never 2000 plus lines. That tells me there is a bigger problem here.

Since I made a backup of my system and spun up a new virtual instance of ERPNext v8 then restored the backup, I can try things with a copy of my live data that I would never attempt on a local server. I am working at a client site for a while so I will have to try the reset --hard tomorrow.

Thank you for your ideas, but I still think it should NEVER have come to this since the only thing I ever did was input data to the system. No customized apps, no custom docs, nothing like that, just data.

BKM

Yes your 2000 lines of changes is odd. Am not sure how this would occur. Just kill all issues with git reset --hard. Good luck tomorrow.

In most cases the upgrade should just run fine. If you have so many files, the most likely scenario is that you may have changed the file permissions after you installed (I have seen this happen before and not sure why).

I am sorry the process is complex, but these are problems related to git and not erpnext per se. If you run this on a clean VM, you should be good to go.

2 Likes

@bkm
Itā€™t not overwrite your database because database are related with site not app.
So first of all you need to take a backup.

After get-app

then you can run bench update --patch or bench --site your_site_name migrate

Why not overwrite your database ?

  • Database migrate (not replace) when your modify date change in you doctype json file.
  • Before Patch run check your database last patch from Patch Log. So only those patch are not run.

So I think your database not overwrite.

and remember one think in your production server if change anything this doesnā€™t effect instants NEED Restart Serve.
Thanks.

As @rmehta mentioned, This is a git issue. I have come across this on different git based projects before as well. Not sure what causes it.

Well, I am not sure how that would have happened. I would think if file permissions changed, that ERPNext would complain loudly and not allow many things to work. Yet I have no problem if I continue working in version 8.

None of the suggested fixes have worked.

Am I really doomed to installing a fresh v9 system and trying to export/import all of my data?

That would really suck. I would loose all of the historical information in the system.

BKM

Thank you. That makes sense and I feel a bit better about continuing to experiment to find a way to make the upgrade work. However, if this kind of problem is going to be a constant issue, it may be time to rethink ERPNext.

If the developers are not going to do something about the source of the problem, I cannot see anyone ever wanting to use the system and be forever stuck at the version they start. If upgrades cannot work, then why pour time and resources into a business system that you cannot port to newer versions without giving up historical context at the very least or lose all data at the worst.

Frustrated!

BKM