Is it possible to run v5 and v4 on same virtual machine?

Hi,

I would like to know if it is possible to run v4 and v5 on the same machine.

I have been trying to do it via bench, but when I try to setup bench in a different folder then it is fails on the maria db setup the second time.

Could any one please let me know how to setup the 2 instances of v4 and v5 on same machine (if possible).

yes,

You don’t have to run the easy install script for that,

From home dir,

bench init frappe-bench-5 --apps_path https://raw.githubusercontent.com/frappe/bench/master/install_scripts/erpnext-apps-master.json

will create a new bench called frappe-bench-5. You can then create a new site and run bench start

This would work in development scenario only.

Hi,

I have followed the steps and I able to create a frappe-bench-5 bench and a new site under that bench.

But when I try to migrate to the v5 in this bench, I am getting this error:

error: pathspec 'v5.0' did not match any file(s) known to git.
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/aditya/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/aditya/bench-repo/bench/cli.py", line 210, in _migrate_to_v5
    migrate_to_v5(bench=bench)
  File "/home/aditya/bench-repo/bench/migrate_to_v5.py", line 14, in migrate_to_v5
    checkout_v5(repo, bench=bench)
  File "/home/aditya/bench-repo/bench/migrate_to_v5.py", line 47, in checkout_v5
    exec_cmd("git checkout v5.0", cwd=cwd)
  File "/home/aditya/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'git checkout v5.0' returned non-zero exit status 1

Now the git in the frappe-bench-5 folder of erpnext has the v5.0 branch but I am still getting this error.

I think the bench migrate command is actually going to the erpnext app in the original bench folder instead of v5 bench folder where the v5.0 branch is existing.

Remove the faulty bench

bench init frappe-bench-5 --frappe-branch v5.0
cd frappe-bench-5
bench get-app erpnext https://github.com/frappe/erpnext --branch v5.0
bench new-site test-version5
cat sites/test-version5/site_config.json # note db_name
bench frappe --restore {dbname} {path_to_v4_backup} 
bench frappe --disable_scheduler
bench frappe --latest
bench start

I have noticed that you have mentioned restoring a v4 backup on the v5 setup.

Is it going to work?

Btw, I have successfully installed v5 with the commands.

Another problem I am facing is that I am unable to install the erpnext app on the new site as I am running this command:

bench frappe --install_app erpnext local.site

The error that I am getting is

Installing erpnext... Traceback (most recent call last): File "/home/aditya/frappe-bench/frappe-bench-5/env/bin/frappe", line 9, in <module> load_entry_point('frappe==5.0.0-alpha', 'console_scripts', 'frappe')() File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/cli.py", line 53, in main return run(fn, parsed_args) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/cli.py", line 81, in run out = globals().get(fn)(*args.get(fn), **args) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/cli.py", line 67, in new_fn return fn(*args, **new_kwargs) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/cli.py", line 363, in install_app install_app(app_name, verbose=verbose) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/installer.py", line 118, in install_app add_module_defs(name) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/installer.py", line 217, in add_module_defs d.save() File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/model/document.py", line 203, in save self.insert() File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/model/document.py", line 175, in insert self.db_insert() File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/model/base_document.py", line 232, in db_insert ), d.values()) File "/home/aditya/frappe-bench/frappe-bench-5/apps/frappe/frappe/database.py", line 129, in sql self._cursor.execute(query, values) File "/home/aditya/frappe-bench/frappe-bench-5/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/home/aditya/frappe-bench/frappe-bench-5/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue frappe.exceptions.NameError: (u'Module Def', u'Accounts', IntegrityError(1062, "Duplicate entry 'Accounts' for key 'PRIMARY'"))

Are you trying to install erpnext after restoring the backup or a fresh site?

I am installing erpnext on a fresh site.

I have not tried to restore old backup till now.

Try a bench update and bench frappe --reinstall -f in v5 bench
warning: will wipe database and start afresh

Just wanted to know I am trying to import a v4 backup and I am getting the error for shopping_cart module, I think the same has been merged with erpnext app in v5, so how do I get across the problem.

I think I would also need to install the custom_apps, but first I would like to get through the problem of shopping cart.