ERPNext upgrade from Version 13 to Version 14 - Ubuntu

Frapp ERPNext upgrade from V13 to V14 - Ubnutu

 · 3 min read

Frappe (@frappetech) / Twitter


The video version of this document is available on https://youtu.be/9S3APcmAql8 , where we are explaining the concept and procedures in details


( commands are in blue letters )


Note: You need NOT upgrade Ubuntu from 20+ to 22+ for upgrading ERPNext to Version 14. EPRNext and Frappe 14 works both on Ubuntu 20+ and 22+ )


1- Take backup. ( Should I explain that !!! )


2- Make sure you don't have any customization those are not committed.

cd /opt/bench/frappe-bench/apps/erpnext

git status

Refresh index: 100% (6953/6953), done.

On branch version-13

Your branch is up to date with 'upstream/version-13'.

nothing to commit, working tree clean


/opt/bench/frappe-bench/apps/frappe

git status

On branch version-13

Your branch is up to date with 'upstream/version-13'.

nothing to commit, working tree clean


3-Check python version

python3 -V

Python 3.8.10 ( needs to be upgraded to 3.10 )


4-check node version.

node --version

v12.22.12 ( needs to be upgraded to v16.X )


5-Check pip or pip3 version

pip3 --version

20.2 ( needs to be upgrade to 22.x )



6- Upgrade python

sudo apt install software-properties-common -y

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt install python3.10 python3.10-dev python3.10-distutils


Confirm python version upgrade by

python3.10 --version

Python 3.10.6


Make Python 3.10 the default.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1


Make sure python command executes python3

sudo apt install python-is-python3


python -V

Python 3.10.6


python3 -V

Python 3.10.6



7 - Upgrade PIP

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

pip install html5lib

pip3 install --upgrade pip

sudo apt-get remove python3-apt -y

sudo apt-get install python3-apt -y


check PIP verison and confirm.

pip --version

pip 22.2.2 from /home/erpnext/.local/lib/python3.10/site-packages/pip (python 3.10)

pip3 --version

pip 22.2.2 from /home/erpnext/.local/lib/python3.10/site-packages/pip (python 3.10)


8- Upgrade Node

curl -sL https://deb.nodesource.com/setup_16.x | bash -

apt-get install nodejs redis-server -y


check node version and confirm

node --version

v16.17.0


9- Upgrade NPM

npm upgrade

sudo npm install 16

sudo npm install -g npm@8.19.1


check npm version and confirm

npm --version

8.19.1



10 -Move your old python env folder to env-archive, in-case anything goes wrong, you can return to the original


cd /opt/bench/frappe-bench/

mv env env-archive

----


11- Create new virtual env for python-3.10

pip install virtualenv

virtualenv --python python3.10 env

env/bin/pip install -U pip


12- Change git upstream from V13 to V14


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

pip3 install frappe-bench

bench switch-to-branch frappe erpnext version-14 ( edited this line. Please see the note 2 ** )

( If the above command don't work, use this one ) bench switch-to-branch version-14 frappe erpnext --upgrade 


check upstream and make sure upstream repository is V14

cd /opt/bench/frappe-bench/apps/erpnext

git status

Your branch is up to date with 'upstream/version-14'.


cd /opt/bench/frappe-bench/apps/frappe

git status

Your branch is up to date with 'upstream/version-14'.


13- Install and upgrade V14. Please note that monolith is broken on V14 and you must install payments and hrms module in addition to ERPNext


bench get-app payments

bench get-app hrms

bench update --reset

bench --site *sitename* install-app hrms

bench --site *sitename* install-app payments

bench --site v13.erpgulf.com migrate


sudo service supervisor restart

sudo service nginx restart


That is it. Check whether you ERPNext and Frappe upgrade to V14



-------------

Note 1: *

If you face problem with nginx because of log type error ( log type main not found or something like that )

vvim /etc/nginx/nginx.conf and add following on http section.


log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';



-----------------------

Note:2 **


Note from ( https://discuss.erpnext.com/u/flexy2ky )

modify this command in your document:

bench switch-to-branch version-14

As this command will fail if the site has custom apps installed because the command will try to switch the apps to version-14 as well. so the command should be:

bench switch-to-branch frappe erpnext version-14

This ensures that the switch-to-branch command only affects frappe and erpnext and ignores any other installed app.


Team ERPGulf

The team behind ERPGulf blogs here, expresses their thoughts, shares the experience, often show the frustrations. Contact us on support@ERPGulf.com

34 comments
Aravind October 10, 2024

I want documentation of V10 to V14 Migration for frappe and erpnext

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

lxbfYeaa June 18, 2024

1

Matth June 4, 2024

I'm struggling with step 7. The command "pip3 install --upgrade pip" errors out with the following error message: "ImportError: cannot import name 'html5lib' from 'pip.vendor' (/usr/lib/python3/dist-packages/pip/vendor/init.py)" I have tried a couple of commands, but eventually ignoring that and continue with the next commands, and the PIP version then still ends up with Version 24.0. How could I fix that error?

Rehan April 26, 2024

i m facing issue while using this command it giving error in subprocess env/bin/pip install -e apps/frappe -e apps/erpnext please help me out i have spent much time but not find any solution

HUNT16 September 30, 2023

while upgrading pip3 version i faced this error ImportError: cannot import name 'html5lib' from 'pip.vendor' (/usr/lib/python3/dist-packages/pip/vendor/init.py)

shan August 31, 2023

Migration Guide: Moving ERPNext Database from Version 13 to Version 14

Before beginning the migration process, it's crucial to prepare your environment and data to ensure a smooth transition. Follow these steps to migrate your ERPNext instance from version 13 to version 14:

  1. Prepare Your Environment:

    • Turn off the Supervisor service to prevent any automatic restarts.
    • Put your existing version 13 site(s) in maintenance mode using the command: bench --site [site-name] disable-scheduler bench --site [site-name] set-maintenance-mode
  2. Backup Your Data:

    • Create a backup of your version 13 database and files. It's recommended to take backups directly on the ERPNext server using the following commands:

      bench backup-all-sites
      
    • Download the backup files, including any private files, from the server backend using SSH.

  3. Install ERPNext Version 14 on a New Instance:

    • Set up a new instance with ERPNext version 14 using the installation instructions provided in the ERPNext documentation.
  4. Prepare the New Instance:

    • Ensure the new instance is properly configured with all necessary prerequisites.
  5. Database Migration:

    • Create a new site on the version 14 instance:

      bench new-site [new-site-name]
      
    • Restore the version 13 database backup into the new version 14 instance:

      bench --site [new-site-name] --force restore /path/to/backup-file.sql.gz
      
    • Migrate the DocTypes to the new version:

      bench --site [new-site-name] migrate
      
  6. Update Bench and Apps:

    • Update the Bench and apps to the latest version 14 code: bench update --patch
  7. Testing and Verification:

    • Thoroughly test the new version 14 instance to ensure data integrity and functionality.
  8. Final Steps:

    • Turn off maintenance mode on the newly created site:

      bench --site [new-site-name] unset-maintenance-mode
      
    • Restart the Supervisor service to resume normal operations:

      sudo supervisorctl start all
      
    • Run and test all necessary Bench commands to ensure the migrated site is working as expected.

Please note that this guide provides a general outline of the migration process. For the most accurate and up-to-date instructions, refer to the official ERPNext documentation. Additionally, consider consulting with ERPNext professionals like erpgulf to minimize risks during the migration process.

Pavithra February 15, 2023

Unable to execute the command "virtualenv --python python3.10 env" successfully shows error Already using interpreter /usr/bin/python3 Using base prefix '/usr' New python executable in /home/erpnext/erpbench/myenv/bin/python3 Not overwriting existing python script /home/erpnext/erpbench/myenv/bin/python (you must use /home/erpnext/erpbench/myenv/bin/python3) Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 8, in <module> sys.exit(main()) File "/usr/lib/python3/dist-packages/virtualenv.py", line 714, in main createenvironment(homedir, File "/usr/lib/python3/dist-packages/virtualenv.py", line 944, in createenvironment pyexecutable = os.path.abspath(installpython( File "/usr/lib/python3/dist-packages/virtualenv.py", line 1466, in installpython fixlocalscheme(homedir, symlink) File "/usr/lib/python3/dist-packages/virtualenv.py", line 1549, in fixlocalscheme if sysconfig.getdefaultscheme() == 'posixlocal': AttributeError: module 'sysconfig' has no attribute 'getdefaultscheme'. Did you mean: 'getdefaultscheme'?

please help with the solution..for this

sumti January 13, 2023
from collections import namedtuple, Mapping

ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)

Kanuns December 6, 2022

I am stuck on the following error

bench --site mysite migrate

Migrating mysite Executing frappe.patches.v140.setuplikesfromfeedback in mysite (b7b324d5487a1a21) Building search index for mysite Retrieving Routes : [========================================] 100% Building Index : [========================================] 100% Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _runmoduleasmain return runcode(code, mainglobals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _runcode exec(code, runglobals) File "/home/frappe/myfrappe/apps/frappe/frappe/utils/benchhelper.py", line 109, in <modu le> main() File "/home/frappe/myfrappe/apps/frappe/frappe/utils/benchhelper.py", line 18, in main click.Group(commands=commands)(progname="bench") File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 829, in call return self.main(args, *kwargs) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 1259, i n invoke return processresult(subctx.command.invoke(subctx)) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 1259, i n invoke return processresult(subctx.command.invoke(subctx)) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 1066, i n invoke return ctx.invoke(self.callback, *ctx.params) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke return callback(args, *kwargs) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/click/decorators.py", line 2 1, in new_func return f(get_current_context(), *args, *kwargs) File "/home/frappe/myfrappe/apps/frappe/frappe/commands/init.py", line 29, in func ret = f(frappe.dict(ctx.obj), args, *kwargs) File "/home/frappe/myfrappe/apps/frappe/frappe/commands/site.py", line 552, in migrate SiteMigration( File "/home/frappe/myfrappe/apps/frappe/frappe/migrate.py", line 175, in run self.runschemaupdates() File "/home/frappe/myfrappe/apps/frappe/frappe/migrate.py", line 41, in wrapper ret = method(args, *kwargs) File "/home/frappe/myfrappe/apps/frappe/frappe/migrate.py", line 110, in runschemaupdat es frappe.modules.patchhandler.runall( File "/home/frappe/myfrappe/apps/frappe/frappe/modules/patchhandler.py", line 75, in run _all runpatch(patch) File "/home/frappe/myfrappe/apps/frappe/frappe/modules/patchhandler.py", line 62, in run _patch if not runsingle(patchmodule=patch): File "/home/frappe/myfrappe/apps/frappe/frappe/modules/patchhandler.py", line 150, in ru nsingle return executepatch(patchmodule, method, methodargs) File "/home/frappe/myfrappe/apps/frappe/frappe/modules/patchhandler.py", line 186, in ex ecutepatch _patch() File "/home/frappe/myfrappe/apps/frappe/frappe/patches/v140/setuplikesfromfeedback.py ", line 7, in execute if frappe.db.count("Feedback") > 20000: File "/home/frappe/myfrappe/apps/frappe/frappe/database/database.py", line 1102, in count count = self.sql(query, debug=debug)[0][0] File "/home/frappe/myfrappe/apps/frappe/frappe/database/database.py", line 218, in sql self.cursor.execute(query, values) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/cursors.py", line 14 8, in execute result = self.query(query) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/cursors.py", line 31 0, in _query conn.query(q) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/connections.py", lin e 548, in query self.affectedrows = self.readqueryresult(unbuffered=unbuffered) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/connections.py", lin e 775, in readqueryresult result.read() File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/connections.py", lin e 1156, in read firstpacket = self.connection.readpacket() File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/connections.py", lin e 725, in readpacket packet.raiseforerror() File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/protocol.py", line 2 21, in raiseforerror err.raisemysqlexception(self.data) File "/home/frappe/myfrappe/env/lib/python3.10/site-packages/pymysql/err.py", line 143, i n raisemysqlexception raise errorclass(errno, errval) pymysql.err.ProgrammingError: (1146, "Table 'b7b324d5487a1a21.tabFeedback' doesn't exist")

Can please help? my site is not working anymore.

GoldenScrew November 7, 2022

I did all, but my education module is lost :( What should I do?

GoldenScrew November 7, 2022

I found solution. I had another directory...

GoldenScrew November 7, 2022

When I try to do 12- Change git upstream from V13 to V14

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

I have the error:

ERROR: apps/frappe is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+lp, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).

Add Comment