I’m glad to hear that it wasn’t my fault that it was failing, I guess I need to switch to installing a released version rather than pulling from master
and hoping it currently works?
I have switched to version 4.1 of bench (checked out using Ansible) and still I have this error when running bench new-site ...
:
"ImportError: Module import failed for Report (frappe.core.doctype.report.report Error: No module named file_manager)"
So I think I need to work out how to install a specific version of frappe
…?
This is what I’m doing to try and get a working ERPNext site up and running:
su - erpnext
git clone https://github.com/frappe/bench.git .bench
cd .bench
git checkout tags/4.1
cd
pip install --user -e .bench
.local/bin/bench init frappe-bench
This ends with this error:
npm WARN enoent ENOENT: no such file or directory, open '/home/erpnext/frappe-bench/package.json'
npm WARN frappe-bench No description
npm WARN frappe-bench No repository field.
npm WARN frappe-bench No README data
npm WARN frappe-bench No license field.
yarn run v1.12.3
$ FRAPPE_ENV=production node rollup/build.js
module.js:478
throw err;
^
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/erpnext/frappe-bench/apps/frappe/rollup/build.js:3:15)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
INFO:bench.utils:setting up backups
INFO:bench.utils:setting up auto update
Bench frappe-bench initialized
This is with a new version of Yarn:
yarn --version
1.12.3
If I ignore the errors and continue…
cd frappe-bench
../.local/bin/bench new-site --mariadb-root-username root --mariadb-root-password XXX --db-name erpnext --admin-password YYY $( hostname -f)
This then fails with the same error as above:
Installing frappe...
Updating DocTypes for frappe : [======= ]Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
main()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 33, in new_site
db_type = db_type)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 70, in _new_site
_install_app(app, verbose=verbose, set_as_patched=not source_sql)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/installer.py", line 85, in install_app
sync_for(name, force=True, sync_everything=True, verbose=verbose, reset_permissions=True)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/sync.py", line 56, in sync_for
reset_permissions=reset_permissions, for_sync=True)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 65, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 133, in import_doc
doc.insert()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 248, in insert
self.run_post_save_methods()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 915, in run_post_save_methods
self.run_method("on_update")
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 780, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 1058, in composer
return composed(self, method, *args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 1041, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File "/home/erpnext/frappe-bench/apps/frappe/frappe/model/document.py", line 774, in <lambda>
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 275, in on_update
self.run_module_method("on_doctype_update")
File "/home/erpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 342, in run_module_method
module = load_doctype_module(self.name, self.module)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/modules/utils.py", line 186, in load_doctype_module
raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for Report (frappe.core.doctype.report.report Error: No module named file_manager)
I don’t want a bleeding edge version I want something stable I can use in production, is this possible to achieve?
I’ve just found this thread and switching to the staging
branch:
git clone https://github.com/frappe/bench.git .bench
cd .bench
git checkout -b staging
cd
pip install --user -e .bench
.local/bin/bench init frappe-bench --frappe-branch staging
cd frappe-bench
../.local/bin/bench new-site --mariadb-root-username root --mariadb-root-password XXX --db-name erpnext --admin-password YYY $( hostname -f)
And this works… is the staging
branch the best one to use for production then?
Only just… I would say yes but there have been several breaking updates in bringing V11 to life. I wait for Merge branch ‘staging’ into develop and then do a bench update --reset. So in answer to your question, I would use the dev branch as the Master Branch lacks so many features compared to V11 staging/develop. Also both ERPNext and frappe API have progressed a lot and system has been massively optimised in V11. Is this good practice… No…But from your posts above you appear well equiped to survive any hiccups that come along. Just Back Up… Of course…
I am currently running
bench 4.1.0
erpnext 11.0.3-beta.24
frappe 11.0.3-beta.29
And am still keenly awaiting some PR’s to make the healthcare module better.
Thanks for the replies.
That is over two years old — this is still the best version?
How are you installing it, I have been using:
bench get-app --branch XX erpnext https://github.com/frappe/erpnext
And I have been trying with develop
, staging
and master
and they have either been failing with errors or resulting in a site that doesn’t have a working login link.
Should I assume since all the tests appear to be failing on all the branches this is to be expected?
I’m specifying the frappe version using:
bench init frappe-bench --frappe-branch XX
Again I have been trying various combinations of develop
, staging
and master
with no luck in getting a working site up and running.
I don’t want a beeding edge version, I don’t want the latest features, I just want to be able to install ERPNext on a server using Ansible in a way that works every time — does anyone know if there is a way to achieve this?
I removed all the references to specific branches and versions and reinstalled everything and it is working again, I guess you just need to cross your fingers every time you install ERPNext and hope that the code that is pulled from GitHub that day actually works?
bench 4.1.0 is the master branch of bench. It was last updated 20 days ago.
In short:
Always run the master branch of bench. This is in both your Dev and Live Production instance.
After you have created a instance with
bench init frappe-bench
cd frappe-bench
On your local Dev version:
bench get-app erpnext GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
bench new-site site1.local
bench --site site1.local install-app erpnext
bench switch-to-branch staging
bench start
On your Live production instance you would
bench get-app erpnext GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
bench new-site myurl.com
bench --site myurl.com install-app erpnext
bench switch-to-master
bench start
Using the Above will create:
A Local Dev instance running master branch of bench with staging branch of both frappe and erpnext.
A Live Production instance running master branch of bench with master branch of both frappe and erpnext.
HTH
Sorry, my bad, I thought you were referencing the latest release, 4.1 dated Aug 3, 2016.
Thanks, I’ll add the bench switch-to-master
command to my Ansible tasks.
All good.
Github branch naming has gone a bit weird recently with the Dev branch currently being called the Staging branch.
Using bench switch-to-master
produced:
Branch master set up to track remote branch master from upstream.
Already up-to-date.
Switching for frappe
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
Running bench update --patch
results in:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 94, in <module>
main()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/erpnext/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/home/erpnext/frappe-bench/apps/frappe/frappe/commands/site.py", line 293, in backup
frappe.connect()
File "/home/erpnext/frappe-bench/apps/frappe/frappe/__init__.py", line 167, in connect
from frappe.database import Database
ImportError: cannot import name Database
And the site simply returns 500 Internal Server Errors, I’m going to omit that command for the moment…
I used the below commands:
git clone GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps bench-repo
pip install --user -e bench-repo
bench init frappe-bench && cd frappe-bench
And I got the following error:
ImportError: Module import failed for Report (frappe.core.doctype.report.report Error: No module named file_manager)
The question is: the above commands are not installing the master branch of bench?
How can we let it installing the master branch of bench?
Regards
Bilal
The default bench install is from the master branch - to check for this:
frappe@ubuntu:~/frappe-bench$ cd ../.bench/
frappe@ubuntu:~/.bench$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
frappe@ubuntu:~/.bench$ bench --version
4.1.0
Hello @clarkej
Why I can not find .bench directory?
I am looking for it under /home/frappe and not under frappe-bench, but I can not find it. Why?
Regards
Bilal
Because you cloned it into bench-repo
:
Thanks good catch chrisc!
My instance is from a VM download, with ERPNext preinstalled, so that explains my case why the bench is written to .bench and not for eg bench-repos.
In Linux all folders/files prefixed with a . are treated as hidden. So .whatever will not be visible with the ls
command. To view these files you need to add the -a
flag like this ls -a
Thanks for asking, I’ve not tried again yet, I have been working on other things, I’ll get back to it soon and let you know.