Unable to switch to master branch for erpnext

Greetings to team!

I installed erpnext on ubuntu 16.04 successfully.
But when I did

bench switch-to-master

only frappe app is switched to master branch and for erpnext, it shows below message on terminal:

“Branch master does not exist in Upstream for erpnext”

Also I tried,
cd app/erpnext
/erpnext $ git branch

It is still showing *develop branch

How can I switch to master branch for erpnext app?

Hi @harsh

System throwing an error Branch master does not exist, which command did you run to switch branch from develop to master?

Hi @rohit_w

bench switch-to-master 

I ran this command. As a result, only frappe app is switched to master branch.

Hi @harsh

Run following commands in the erpnext folder and check

git fetch upstream master:master
git checkout master
3 Likes

Hi,

It’s common mistake which i guess we all are doing when shifting from Develop to master. i was also facing the same issue.

here are the steps you have to perform.

  1. goto frappe-bench/apps/
  2. Remove erpnext (rm -r erpnext)
  3. Goto frappe-bench/
  4. bench get-app erpnext https://github.com/frappe/erpnext --branch master
  5. now run bench update.

through these steps you’ll have frappe as well as erpnext in master branch

2 Likes

Hi @adnan

Thanks a lot for this. Now successfully installed and switched to master branch.

But now facing “There were errors” issue while completing the setup wizard.
Can you suggest anything for this?

in this case, i suggest, remove this app and install it again. should work fine.

did the same. but still same error.

Then I just dropped the site and created a new one and intalled the erpnext.

It worked for me. Thanks for your kind help. :slight_smile:

Hi,
I’ve successfully switched erpnext to master. But my frappe framework still remain as develop. Kindly help to advise if you have any idea on this. thanks.

goto frappe-bench/apps/
Remove erpnext (rm -r erpnext)
Remove frappe (rm -r frappe)
Goto frappe-bench/
bench get-app frappe https://github.com/frappe/frappe --branch master
bench get-app erpnext https://github.com/frappe/erpnext --branch master
now run bench update.

Get the following error :

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 39, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 133, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 149, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 156, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 175, in build_page
html = frappe.render_template(context.source, context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 69, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 1, in top-level template code
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 1, in top-level template code
{% extends base_template_path %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 69, in top-level template code
{% block content %}{% endblock %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 47, in block “content”
{%- block page_content -%}{%- endblock -%}
File “”, line 29, in block “page_content”
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 430, in getattr
return getattr(obj, attribute)
UndefinedError: ‘ldap_settings’ is undefined

Can help ?

help to advise how to solve the following while running “bench update”

INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Updating 94d346c…cfe169a
error: Your local changes to the following files would be overwritten by merge:
MANIFEST.in
bench/init.py
bench/config/redis.py
playbooks/develop/includes/setup_bench.yml
playbooks/develop/includes/setup_erpnext.yml
playbooks/develop/install.yml
playbooks/prerequisites/roles/nginx/tasks/main.yml
playbooks/production/includes/setup_bench_production.yml
playbooks/production/includes/setup_inputrc.yml
Please, commit your changes or stash them before you can merge.
Aborting
Traceback (most recent call last):
File “/home/frappe/.local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/update.py”, line 34, in update
update_bench()
File “/home/frappe/bench-repo/bench/utils.py”, line 256, in update_bench
exec_cmd(“git pull”, cwd=cwd)
File “/home/frappe/bench-repo/bench/utils.py”, line 140, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: git pull

Hi @adnan, sorry to trouble, the problem solved with the following :slight_smile:

Go to ~/bench-repo/playbooks
then :
git stash
git checkout develop

and redo bench update.

I’ve tried this and I get error because of frappe_io folder. I also removed that with
rm -r frappe_io
But then I get “ImportError: No module named ‘frappe_io.commands’” error. I use easy install on ubuntu 16 with develop switch. I will try to set master branch with production switch. My full error log is below.

turker@turker-fd2:~/frappe-bench$ bench get-app frappe https://github.com/frappe/frappe --branch master
INFO:bench.app:getting app frappe
INFO:bench.utils:git clone https://github.com/frappe/frappe --branch master --depth 1 --origin upstream
Cloning into ‘frappe’…
remote: Enumerating objects: 2482, done.
remote: Counting objects: 100% (2482/2482), done.
remote: Compressing objects: 100% (2271/2271), done.
remote: Total 2482 (delta 347), reused 1136 (delta 148), pack-reused 0
Receiving objects: 100% (2482/2482), 18.15 MiB | 515.00 KiB/s, done.
Resolving deltas: 100% (347/347), done.
Checking connectivity… done.
(‘installing’, u’frappe’)
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q -e ./apps/frappe --no-cache-dir
INFO:bench.app:getting app frappe_io
INFO:bench.utils:git clone https://github.com/frappe/frappe_io --branch master --depth 1 --origin upstream
Cloning into ‘frappe_io’…
remote: Enumerating objects: 628, done.
remote: Counting objects: 100% (628/628), done.
remote: Compressing objects: 100% (591/591), done.
remote: Total 628 (delta 16), reused 360 (delta 10), pack-reused 0
Receiving objects: 100% (628/628), 18.13 MiB | 981.00 KiB/s, done.
Resolving deltas: 100% (16/16), done.
Checking connectivity… done.
(‘installing’, u’frappe_io’)
INFO:bench.app:installing frappe_io
INFO:bench.utils:./env/bin/pip install -q -e ./apps/frappe_io --no-cache-dir
Traceback (most recent call last):
File “/home/turker/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 64, in get_app_commands
app_command_module = importlib.import_module(app + ‘.commands’)
File “/home/turker/frappe-bench/env/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 956, in _find_and_load_unlocked
ImportError: No module named ‘frappe_io.commands’
Traceback (most recent call last):
File “/home/turker/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 64, in get_app_commands
app_command_module = importlib.import_module(app + ‘.commands’)
File “/home/turker/frappe-bench/env/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 944, in _find_and_load_unlocked
File “”, line 222, in _call_with_frames_removed
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 956, in _find_and_load_unlocked
ImportError: No module named ‘erpnext’
Traceback (most recent call last):
File “/home/turker/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 64, in get_app_commands
app_command_module = importlib.import_module(app + ‘.commands’)
File “/home/turker/frappe-bench/env/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 956, in _find_and_load_unlocked
ImportError: No module named ‘foundation.commands’
Traceback (most recent call last):
File “/usr/lib/python3.5/runpy.py”, line 184, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.5/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/turker/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 94, in
main()
File “/home/turker/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/turker/frappe-bench/env/lib/python3.5/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/turker/frappe-bench/apps/frappe/frappe/commands/utils.py”, line 17, in build
frappe.init(’’)
File “/home/turker/frappe-bench/apps/frappe/frappe/init.py”, line 158, in init
setup_module_map()
File “/home/turker/frappe-bench/apps/frappe/frappe/init.py”, line 872, in setup_module_map
for module in get_module_list(app):
File “/home/turker/frappe-bench/apps/frappe/frappe/init.py”, line 746, in get_module_list
return get_file_items(os.path.join(os.path.dirname(get_module(app_name).file), “modules.txt”))
File “/home/turker/frappe-bench/apps/frappe/frappe/init.py”, line 704, in get_module
return importlib.import_module(modulename)
File “/home/turker/frappe-bench/env/lib/python3.5/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 986, in _gcd_import
File “”, line 969, in _find_and_load
File “”, line 956, in _find_and_load_unlocked
ImportError: No module named ‘erpnext’

I’ve examined the install.py and easy install has some switches to specify branches of frappe and erpnext.
–frappe-branch
–erpnext-branch

1 Like

Downgrade from develop to master is not an easy task because we don’t necessary have downgrade scripts.
Git repos are the effective code but database structures and data must be in the same level as git code, so the bench migrate command called in the bench update.
All is available to upgrade from master to develop and you shouldn’t downgrade when develop and master are too different.
The best way should be to import data in a new master instance.

Regards.

Yes, it is not easy task but bench init also has branch parameter. I use it for creating new bench. My complete workflow is this:

git clone --branch master https://github.com/frappe/bench bench-repo
sudo -H pip install -e bench-repo

bench init frappe-bench --frappe-branch master && cd frappe-bench
bench new-site test1
bench use test1