ERPNext install fails with setup wizard : Duplicate name

When I install Bench, Frappe and ERPnext from scratch it appears to go without an error until the Setup Wizard, after entering the Company Information I get the following:

In the frappe-bench/logs/web.error.log I have:

[2018-12-10 12:08:30 +0000] [3486] [INFO] Starting gunicorn 19.9.0
[2018-12-10 12:08:30 +0000] [3486] [INFO] Listening at: http://127.0.0.1:8000 (3486) 
[2018-12-10 12:08:30 +0000] [3486] [INFO] Using worker: sync
[2018-12-10 12:08:30 +0000] [3523] [INFO] Booting worker with pid: 3523
fatal: Needed a single revision                                      
fatal: Needed a single revision         
fatal: Needed a single revision
fatal: Needed a single revision   
fatal: Needed a single revision
fatal: Needed a single revision

I couldn’t find any other log files with issues in ~/frappe-bench/logs, however in /var/log/supervisor/supervisord.log I have:

2018-12-10 12:08:24,698 INFO supervisord started with pid 3451
2018-12-10 12:08:25,700 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:25,700 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:25,701 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:25,701 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:25,718 INFO spawned: 'frappe-bench-frappe-web' with pid 3486
2018-12-10 12:08:25,742 INFO spawned: 'frappe-bench-node-socketio' with pid 3487
2018-12-10 12:08:25,780 INFO spawned: 'frappe-bench-redis-queue' with pid 3488
2018-12-10 12:08:25,827 INFO spawned: 'frappe-bench-redis-cache' with pid 3489
2018-12-10 12:08:25,886 INFO spawned: 'frappe-bench-redis-socketio' with pid 3496
2018-12-10 12:08:26,987 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:26,987 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:26,987 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:26,988 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:26,988 INFO success: frappe-bench-frappe-web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-12-10 12:08:26,988 INFO success: frappe-bench-node-socketio entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-12-10 12:08:26,988 INFO success: frappe-bench-redis-queue entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-12-10 12:08:26,988 INFO success: frappe-bench-redis-cache entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-12-10 12:08:26,988 INFO success: frappe-bench-redis-socketio entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-12-10 12:08:29,909 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:29,909 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:29,910 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:29,910 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:33,209 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:33,209 INFO gave up: frappe-bench-frappe-default-worker-0 entered FATAL state, too many start retries too quickly
2018-12-10 12:08:33,209 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:33,210 INFO gave up: frappe-bench-frappe-schedule entered FATAL state, too many start retries too quickly
2018-12-10 12:08:33,210 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:33,210 INFO gave up: frappe-bench-frappe-long-worker-0 entered FATAL state, too many start retries too quickly
2018-12-10 12:08:33,210 INFO spawnerr: can't find command 'None'
2018-12-10 12:08:33,210 INFO gave up: frappe-bench-frappe-short-worker-0 entered FATAL state, too many start retries too quickly

Does anyone have any suggestions regarding how I can debug this or what I can do to fix it?

I just started again with a brand new virtual server and and end result was exactly the same as the screenshot above.

These are the versions I’m running:

bench version  
erpnext 12.x.x-develop
foundation 0.0.1
frappe 12.x.x-develop

A bench restart returns:

INFO:bench.utils:sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-default-worker-0: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-long-worker-0: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-short-worker-0: ERROR (no such file)
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started

I tried updating:

bench update             
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (5.3.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream develop
From https://github.com/frappe/frappe
 * branch                develop    -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling frappe_io
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe_io
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git pull  upstream develop
From https://github.com/frappe/erpnext
 * branch            develop    -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling foundation
INFO:bench.utils:git pull  upstream master
From https://github.com/erpnext/foundation
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (18.1)
INFO:bench.utils:./env/bin/pip install -q -r /home/erpnext/.bench/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/foundation/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe_io/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/frappe/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/requirements.txt
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.12.3
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.49s.
Backing up sites...
Patching sites...
Migrating erpnext.example.org
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
Syncing help database...
yarn run v1.12.3
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building frappe assets...

✔ Built js/print_format_v3.min.js
✔ Built js/dialog.min.js
✔ Built js/web_form.min.js
✔ Built js/social.min.js
✔ Built js/form.min.js
✔ Built js/list.min.js
✔ Built js/frappe-vue.min.js
✔ Built js/chat.js
✔ Built js/desk.min.js
✔ Built css/frappe-rtl.css
✔ Built css/module.min.css
✔ Built css/form.min.css
✔ Built css/list.min.css
✔ Built css/report.min.css
✔ Built frappe/css/email.css
✔ Built js/control.min.js
✔ Built css/web_form.css
✔ Built css/frappe-web.css
✔ Built css/desk.min.css
✔ Built js/frappe-web.min.js
✔ Built js/report.min.js
✨  Done in 87.496s

Building erpnext assets...


✔ Built js/erpnext-web.min.js
✔ Built js/item-dashboard.min.js
✔ Built js/erpnext.min.js
✔ Built css/erpnext-web.css
✔ Built css/erpnext.css
✔ Built css/marketplace.css
✔ Built js/marketplace.min.js
✨  Done in 23.91s
Done in 115.26s.
INFO:bench.utils:sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-default-worker-0: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-long-worker-0: ERROR (no such file)
frappe-bench-workers:frappe-bench-frappe-short-worker-0: ERROR (no such file)
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started
________________________________________________________________________________
Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).
Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community
()

What else can I do to try to track down this problem? Does anyone have any suggestions?

When I click “Close” I get:

Screenshot_2018-12-10%20Frappe%20Desk(2)

And “Retry” results in the same outcome.

I followed the suggestions in this post:

su - erpnext
cd frappe-bench/apps/frappe
git checkout -b staging
git pull upstream staging
cd ..
bench switch-to-branch staging
bench update --patch
bench setup requirements

And then the Setup Wizard completed without an error.

I’m now on these versions:

bench version
erpnext 12.x.x-develop
foundation 0.0.1
frappe 11.0.3-beta.35

Previously I had frappe 12.x.x-develop.

How to people who are using ERPNext in production manage with such a seemingly unstable code base? There must be some tricks to achieve a stable version? Or am I missing something fundamental in the way I’m doing things?

eventhough I can’t say how to get over your problem I am certain it is not a desirable scenario to have frappe on a different branch (staging) then erpnext (develop)

the stable branch is ‘master’. if you did the installation manually I think you have to throw in a --frappe-branch master with the bench init command (by default you are getting develop (same logic applies to bench get-app which will need a --branch master option or you’ll end up on a develop version on your ERPNext instance.

Still the develop branch should still work. Some (incl. Frappe themselves I believe use it for production). But for any regular user the master branch would be the way to go. On your existnig vm’s you should get it my doing the switch-to master routine on both apps. frappe and erpnext

1 Like

The naming of branches is all out of whack recently which is making life confusing for new developers. In your case you want both erpnext and frappe to be 11.0.3-beta.xx
Also I have found that once an initial install has gone bad it is way easier to drop the DB entirely and do a fresh install. Also Github gets confused sometimes with caches. This is Github specific. So in your current situation I would do the following.
Always from within your /frappe-bench/ directory
Drop your failed local site and check that the db that was created with this site is also dropped.

  cd apps/frappe
  git reset --hard
  git clean -fdx
  git checkout staging
  git pull
  cd ..
  cd erpnext
  git reset --hard
  git clean -fdx
  git checkout staging
  git pull
  cd ..
  cd ..
  bench switch-to-branch staging
  bench version
  bench new-site site1.local
  bench --site site1.local install-app erpnext
  bench start

Then go to your web browser and good luck with setup wizard.
Very shortly the staging branch will become the master branch

2 Likes

The bench quick reference guide is helpful

1 Like

Hopefully the next time you post here it is celebration of finally getting this setup to work :slight_smile:Good Luck

1 Like

Thanks for the advice.

I had to change the git pull:

git pull
  fatal: No remote repository specified.  Please, specify either a URL or a
  remote name from which new revisions should be fetched.
git pull upstream staging
  remote: Enumerating objects: 28, done.
  remote: Counting objects: 100% (28/28), done.
  remote: Compressing objects: 100% (15/15), done.
  remote: Total 29 (delta 15), reused 16 (delta 13), pack-reused 1
  Unpacking objects: 100% (29/29), done.
  From https://github.com/frappe/frappe
   * branch                staging    -> FETCH_HEAD
     306ca0f44..6859a73d3  staging    -> upstream/staging
  Auto-merging yarn.lock
  Auto-merging package.json
  Auto-merging frappe/utils/scheduler.py
  Auto-merging frappe/tests/test_scheduler.py
  Auto-merging frappe/public/js/frappe/form/footer/timeline.js
  Auto-merging frappe/hooks.py
  Merge made by the 'recursive' strategy.
   frappe/hooks.py                                       |  2 +-
   frappe/patches/v11_0/delete_all_prepared_reports.py   |  7 ++++---
   frappe/public/js/frappe/form/controls/text_editor.js  |  2 +-
   frappe/public/js/frappe/form/footer/timeline.js       | 14 +++++++++++---
   frappe/public/js/frappe/views/communication.js        | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
   frappe/public/js/frappe/views/reports/query_report.js | 10 ++++++++++
   frappe/tests/test_scheduler.py                        |  3 +++
   frappe/utils/scheduler.py                             |  5 ++++-
   package.json                                          |  2 +-
   yarn.lock                                             |  8 ++++----
   10 files changed, 87 insertions(+), 18 deletions(-)

I tried this:

git checkout staging
  error: pathspec 'staging' did not match any file(s) known to git.
git branch
  * develop
git branch staging
git branch
  * develop
    staging
git checkout staging
  Switched to branch 'staging'
git pull upstream staging
  remote: Enumerating objects: 263232, done.
  remote: Counting objects: 100% (263228/263228), done.
  remote: Compressing objects: 100% (59352/59352), done.
  remote: Total 260515 (delta 202669), reused 257044 (delta 199274), pack-reused 0
  Receiving objects: 100% (260515/260515), 610.26 MiB | 4.94 MiB/s, done.
  Resolving deltas: 100% (202669/202669), completed with 2070 local objects.
  From https://github.com/frappe/erpnext
   * branch                  staging    -> FETCH_HEAD
  fatal: refusing to merge unrelated histories
git pull
  fatal: No remote repository specified.  Please, specify either a URL or a
  remote name from which new revisions should be fetched.

I’m going to blow this VM away and start again… :roll_eyes:

No don’t do that. Sorry… maybe I made a mistake as I swap to staging while I had a running develop version.
So try doing what I listed above but using checkout master.
So do the whole process the same but using master branch.
Once finished bench start and once system is running then do bench switch-to-branch staging then do bench update --reset and all should be good.

last try before we throw the computer out the window and go back to living in caves and rubbing sticks together to make fire… Life was indeed simpler in those days after all :slight_smile:

2 Likes

Sorry I had deleted it before I saw your reply… So on a new VM…

That seems to work for Frappe:

su - erpnext
cd frappe-bench/apps/frappe
git status
  On branch develop
  Your branch is up-to-date with 'upstream/develop'.
  nothing to commit, working tree clean
git reset --hard
  HEAD is now at be5274445 Merge branch 'hotfix'
git clean -fdx
  ...
git checkout master
  Branch master set up to track remote branch master from upstream.
  Switched to a new branch 'master'
git pull
  Already up-to-date.

But not for ERPNext:

cd ../erpnext/
git status
  On branch develop
  Your branch is up-to-date with 'upstream/develop'.
  nothing to commit, working tree clean
git reset --hard
  HEAD is now at fb2fdc4 Merge branch 'staging' into develop
git clean -fdx
  ...
git checkout master
  error: pathspec 'master' did not match any file(s) known to git.
git remote -v
  upstream        https://github.com/frappe/erpnext (fetch)
  upstream        https://github.com/frappe/erpnext (push)
git status
  On branch develop
  Your branch is up-to-date with 'upstream/develop'.
  nothing to commit, working tree clean
git show-ref
  fb2fdc4f4eb11c82ee8b92402323df393c8e4f70 refs/heads/develop
  fb2fdc4f4eb11c82ee8b92402323df393c8e4f70 refs/remotes/upstream/HEAD
  fb2fdc4f4eb11c82ee8b92402323df393c8e4f70 refs/remotes/upstream/develop

Anyone have an idea what is happening here — there is a master branch for ERPNext…?

Sorry to be replying to myself…

Continuing where I left things above:

git branch master
git checkout master
  Switched to branch 'master'
git pull
  fatal: No remote repository specified.  Please, specify either a URL or a
  remote name from which new revisions should be fetched.
git pull upstream master
  remote: Enumerating objects: 236065, done.
  remote: Counting objects: 100% (236062/236062), done.
  remote: Compressing objects: 100% (54280/54280), done.
  remote: Total 233755 (delta 180240), reused 231085 (delta 177628), pack-reused 0
  Receiving objects: 100% (233755/233755), 423.90 MiB | 5.45 MiB/s, done.
  Resolving deltas: 100% (180240/180240), completed with 1653 local objects.
  From https://github.com/frappe/erpnext
   * branch                master     -> FETCH_HEAD
  fatal: refusing to merge unrelated histories

So I’m still stuck…

OK one last attempt. From within frappe-bench/apps/erpnext
git reset
git checkout .
git clean -fdx

(Beware to include the . at the end of git checkout .)

Now from within frappe-bench/
bench switch-to-master
bench version
bench pull --reset
bench version

If this doesn’t work not sure which time zone you are in but maybe I can ssh in?
Cheers

Returning to this, I just did a clean install on a new VM and I got the same error as at the start of this thread.

Without specifying which branches to use I have:

su - erpnext
cd frappe-bench/apps/frappe
git status
  On branch develop
  Your branch is up-to-date with 'upstream/develop'.
  nothing to commit, working tree clean
cd ../erpnext/
git status
  On branch develop
  Your branch is up-to-date with 'upstream/develop'.
  nothing to commit, working tree clean

So following the advice above:

pwd
  /home/erpnext/frappe-bench/apps/erpnext
git reset
git checkout .
git clean -fdx
  ...
cd ../..
bench switch-to-master
  Switching for frappe
  INFO:bench.utils:git config --unset-all remote.upstream.fetch
  INFO:bench.utils:git config --add remote.upstream.fetch '+refs/heads/*:refs/remotes/upstream/*'
  INFO:bench.utils:git fetch upstream 
  INFO:bench.utils:git checkout master
  Branch master set up to track remote branch master from upstream.
  Switched to a new branch 'master'
  INFO:bench.utils:git merge upstream/master
  Already up-to-date.
  Branch master does not exist in Upstream for erpnext
  Successfully switched branches for:
  frappe
  ()
  Switched to master
  Please run `bench update --patch` to be safe from any differences in database schema
bench version
  erpnext 10.1.76
  foundation 0.0.1
  frappe 10.1.68
bench pull --reset
  Usage: bench [OPTIONS] COMMAND [ARGS]...
  Try "bench --help" for help.
  
  Error: No such command "pull".
bench version
  erpnext 10.1.76
  foundation 0.0.1
  frappe 10.1.68

Now when I visit the site it displays:

Uncaught Server Exception

Traceback (most recent call last):
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/website/render.py", line 45, in render
    frappe.local.form_dict.name = name
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/website/render.py", line 139, in render_page_by_language
    if can_cache():
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/website/render.py", line 155, in render_page
    try:
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/website/render.py", line 162, in build
    else:
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/website/render.py", line 178, in build_page
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/jinja.py", line 75, in render_template
    return get_jenv().from_string(template).render(context)
  File "/home/erpnext/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/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/./templates/web.html", line 1, in top-level template code
    {% extends base_template_path %}
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/./templates/base.html", line 69, in top-level template code
    {% block content %}{% endblock %}
  File "/home/erpnext/frappe-bench/apps/frappe/frappe/./templates/web.html", line 47, in block "content"
    {%- block page_content -%}{%- endblock -%}
  File "<template>", line 29, in block "page_content"
  File "/home/erpnext/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

I wiped the VM and started again, this time specifying the master branches where I could and the setup wizard completed without an error and these are the versions I now have:

su - erpnext
bench --version
  4.1.0
cd frappe-bench/
bench version
  erpnext 10.1.76
  foundation 0.0.1
  frappe 10.1.68
cd apps/frappe
git status
  On branch master
  Your branch is up-to-date with 'upstream/master'.
  nothing to commit, working tree clean
cd ../erpnext/
git status
  On branch master
  Your branch is up-to-date with 'upstream/master'.
  nothing to commit, working tree clean
cd ~/.bench/
git status
  On branch master
  Your branch is up-to-date with 'origin/master'.
  nothing to commit, working tree clean

So the answer is to checkout the master versions of everything rather than the defaults.

git clone -b master https://github.com/frappe/bench ~/.bench
...
bench init frappe-bench --frappe-branch master
...
bench get-app --branch master https://github.com/frappe/erpnext
...

But I’m using Ansible to run these commands rather than doing it manually.