Hi, I’m planing to use ERPNext V11 in production server.
Which python is more stable for V11?
Python 2.7 or Python 3
Hi, I’m planing to use ERPNext V11 in production server.
Which python is more stable for V11?
Python 2.7 or Python 3
Python 3
Both version are compatible, but if you are looking for the most stable one I would recommend python 2.7 as python 3 will only be the default language for v12 (there has been no requirement to move Bench to python 3 in v11)
Keep this in mind too: Node.js still has Python 2 as a dependency. Until that’s resolved, you’ll need that installed anyway. Even if you’re doing all other development with Python 3.
Internally we are running both 2 and 3 in production. But if you are on V11, you should move to Python 3 to be future ready.
Also note that the automated tests routinely run on both Python 2.7 and 3.6, but also both MariaDB and Postgres.
Plus the UI tests now run on Cypress Bringing back UI Tests using Cypress
I guess the most straight forward way to be on phyton3 is by running the inital bench init
command with the --python-version
flag but the way this comment is constructed their seems to be a way to migrate to python3 on existing Frappé/ERPNext instances as well. Can anybody point out the details of such a process?
bench migrate-env python3.6
To go back:
bench migrate-env python2.7
If you like speed at the expense of some compatibility:
bench migrate-env pypy
looks like command needs to be bench migrate-env python3
(where /usr/bin/python3
actually is a symlink to 3.5)
lrwxrwxrwx 1 root root 9 Mar 23 2016 python3 -> python3.5)
getting problems with bench update after the switch to p3 though
DEBUG:bench.commands:Migration Successful to /usr/bin/python3
bench@ubn1604:~/frappe-bench$ bench restart
bench@ubn1604:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 19 (delta 10), reused 8 (delta 8), pack-reused 2
Unpacking objects: 100% (19/19), done.
From https://github.com/frappe/bench
651856b..97b2891 master -> origin/master
Updating 651856b..97b2891
Fast-forward
README.md | 2 +-
bench/config/nginx.py | 18 +++++++++++++++++-
playbooks/install.py | 5 +++++
playbooks/site.yml | 32 ++++++++++++++++----------------
4 files changed, 39 insertions(+), 18 deletions(-)
remote: Enumerating objects: 162, done.
remote: Counting objects: 100% (162/162), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 205 (delta 148), reused 152 (delta 148), pack-reused 43
Receiving objects: 100% (205/205), 45.55 KiB | 0 bytes/s, done.
Resolving deltas: 100% (157/157), completed with 86 local objects.
From https://github.com/frappe/frappe
e9a1ad5..0e5d378 staging -> upstream/staging
d5fdc67..1197271 develop -> upstream/develop
12798c9..0e5d378 staging-fixes -> upstream/staging-fixes
* [new tag] v11.0.3-beta.47 -> v11.0.3-beta.47
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python3.5/site-packages (5.4.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull upstream staging
From https://github.com/frappe/frappe
* branch staging -> FETCH_HEAD
Updating e9a1ad5..0e5d378
Fast-forward
frappe/contacts/report/addresses_and_contacts/addresses_and_contacts.py | 30 +++-----
frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py | 106 +++++++++++++++++++++++++++++
frappe/core/doctype/transaction_log/readme.md | 16 +++++
frappe/core/doctype/transaction_log/transaction_log.json | 5 +-
frappe/core/doctype/transaction_log/transaction_log.py | 6 +-
frappe/core/doctype/view_log/test_view_log.js | 6 +-
frappe/core/doctype/view_log/test_view_log.py | 4 +-
frappe/core/doctype/view_log/view_log.js | 2 +-
frappe/core/doctype/view_log/view_log.json | 291 +++++++++++++++++++++++++++++++++++++++---------------------------------------
frappe/core/doctype/view_log/view_log.py | 2 +-
frappe/core/report/transaction_log_report/transaction_log_report.js | 8 ++-
frappe/core/report/transaction_log_report/transaction_log_report.json | 5 +-
frappe/core/report/transaction_log_report/transaction_log_report.py | 7 +-
frappe/desk/form/load.py | 2 +-
frappe/hooks.py | 2 +-
frappe/integrations/doctype/dropbox_settings/dropbox_settings.json | 2 +-
frappe/model/delete_doc.py | 4 +-
frappe/model/document.py | 2 +-
frappe/patches.txt | 6 +-
frappe/patches/v11_0/reload_and_rename_view_log.py | 27 ++++++++
frappe/permissions.py | 4 +-
frappe/public/js/frappe/chat.js | 4 +-
frappe/public/js/frappe/form/footer/timeline.js | 2 +-
frappe/public/js/frappe/views/reports/query_report.js | 4 +-
frappe/tests/test_db_query.py | 30 ++++++++
frappe/tests/test_naming.py | 11 +--
frappe/tests/test_permissions.py | 10 +++
frappe/website/utils.py | 2 +
28 files changed, 400 insertions(+), 200 deletions(-)
create mode 100644 frappe/contacts/report/addresses_and_contacts/test_addresses_and_contacts.py
create mode 100644 frappe/core/doctype/transaction_log/readme.md
create mode 100644 frappe/patches/v11_0/reload_and_rename_view_log.py
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 staging
remote: Enumerating objects: 444, done.
remote: Counting objects: 100% (317/317), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 164 (delta 132), reused 135 (delta 104), pack-reused 0
Receiving objects: 100% (164/164), 25.07 KiB | 0 bytes/s, done.
Resolving deltas: 100% (132/132), completed with 33 local objects.
From https://github.com/frappe/erpnext
* branch staging -> FETCH_HEAD
1fa3f7d..094d539 staging -> upstream/staging
Updating 1fa3f7d..094d539
Fast-forward
erpnext/accounts/report/financial_statements.py | 2 +-
erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py | 60 ++++++++++++-----------
erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
erpnext/hooks.py | 2 +-
erpnext/hr/doctype/department/test_department.py | 17 ++++++-
erpnext/hr/doctype/employee/employee.py | 16 ++++--
erpnext/hr/doctype/employee/test_employee.py | 13 +++++
erpnext/hr/doctype/leave_application/test_leave_application.py | 2 +-
erpnext/hr/doctype/upload_attendance/test_upload_attendance.py | 33 +++++++++++++
erpnext/hr/doctype/upload_attendance/upload_attendance.py | 33 ++++++++++---
erpnext/manufacturing/doctype/bom_item/bom_item.json | 210 ++++++++++++++++++++++++-------------------------------------------------------
erpnext/projects/doctype/timesheet/test_timesheet.py | 2 +
erpnext/utilities/transaction_base.py | 14 +++++-
13 files changed, 376 insertions(+), 193 deletions(-)
create mode 100644 erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
create mode 100644 erpnext/hr/doctype/upload_attendance/test_upload_attendance.py
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
INFO:bench.app:pulling bookingapp
INFO:bench.utils:git pull upstream master
From https://github.com/jigartarpara/bookingapp
* 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/python3.5/site-packages (18.1)
INFO:bench.utils:./env/bin/pip install -q -r /opt/bench/bench-repo/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/frappe_io/requirements.txt
INFO:bench.utils:./env/bin/pip install -q -r ./apps/erpnext/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/bookingapp/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 0.64s.
Backing up sites...
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 "/opt/bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
main()
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name='bench')
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/opt/bench/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 "/opt/bench/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 "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/opt/bench/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/opt/bench/frappe-bench/apps/frappe/frappe/commands/site.py", line 302, in backup
odb = scheduled_backup(ignore_files=not with_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, backup_path_private_files=backup_path_private_files, force=True)
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/backups.py", line 172, in scheduled_backup
odb = new_backup(older_than, ignore_files, backup_path_db=backup_path_db, backup_path_files=backup_path_files, force=force)
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/backups.py", line 182, in new_backup
odb.get_backup(older_than, ignore_files, force=force)
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/backups.py", line 48, in get_backup
self.set_backup_file_name()
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/backups.py", line 63, in set_backup_file_name
todays_date = now_datetime().strftime('%Y%m%d_%H%M%S')
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/data.py", line 121, in now_datetime
dt = convert_utc_to_user_timezone(datetime.datetime.utcnow())
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/data.py", line 144, in convert_utc_to_user_timezone
return utcnow.astimezone(timezone(get_time_zone()))
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/data.py", line 138, in get_time_zone
return frappe.cache().get_value("time_zone", _get_time_zone)
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value
val = generator()
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/data.py", line 132, in _get_time_zone
return frappe.db.get_system_setting('time_zone') or 'Asia/Kolkata' # Default to India ?!
File "/opt/bench/frappe-bench/apps/frappe/frappe/database.py", line 943, in get_system_setting
return frappe.cache().get_value("system_settings", _load_system_settings).get(key)
File "/opt/bench/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 72, in get_value
val = generator()
File "/opt/bench/frappe-bench/apps/frappe/frappe/database.py", line 942, in _load_system_settings
return self.get_singles_dict("System Settings")
File "/opt/bench/frappe-bench/apps/frappe/frappe/database.py", line 603, in get_singles_dict
""", doctype)
File "/opt/bench/frappe-bench/apps/frappe/frappe/database.py", line 165, in sql
self.connect()
File "/opt/bench/frappe-bench/apps/frappe/frappe/database.py", line 115, in connect
charset='utf8mb4', use_unicode = True, conv = conversions, local_infile = self.local_infile)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/__init__.py", line 94, in Connect
return Connection(*args, **kwargs)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/connections.py", line 325, in __init__
self.connect()
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/connections.py", line 599, in connect
self._request_authentication()
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/connections.py", line 861, in _request_authentication
auth_packet = self._read_packet()
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/connections.py", line 684, in _read_packet
packet.check_error()
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/opt/bench/frappe-bench/env/lib/python3.5/site-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user '7a6f4ef655be499a'@'localhost' (using password: YES)")
Any pointer how to get passed this? is this a mariadb access issue for the 7a6f4ef655be499a
user? It wasn’t a problem prior the migration.
Also I have one custom app running. can this be the problem?
yea. that was the problem. ran bench uninstall-app bookingapp
& bench remove-from-installed-apps bookingapp
and all goes well.
So to upgrade for python 3, I have to remove the custom applications and then re-install it?
Regards
Bilal
Have you tried it? Will we have to remove custom app and then install it again after migrating to Python 3?
Tried it many times for many different apps. It’s completely case by case, just uninstalling and reinstalling isn’t going to fix it. Most often the problem is with pip, but I’ve had problems migrating with import
statements as well.
If python3 is more stable with v11 then why is it not installed by default?
Could you explain better the meaning of “at the expense of some compatibility” if I want to use pypy
?
Speed is something always nice to get, but what compatibility I have to sacrifice to get that?
Sagar has done more experimentation with this than I and my opinion is based on having used it without issues, but Sagar mentioned that there were specific incompatibilities with PDF generation. If you need everything about Frappe and ERPNext to work, that’s not a reasonable expectation, because pypy is not included in any test suites.
If the issues regarding PDF, i could try a dev env and check what’s going on.
But if ERP Next is not tested officially with pypy, i will not use it in any prod env
We’re facing the same issue with Python 3, we upgraded to python 3 and not PDF aligned and letterhead print is broken. We have try to do everything possible but I cant seem to find any solution.
Before it was not even previewing in pdf, would take around 5-10mins to load pdf and blocking the server usage, But just upgraded to the latest v11 release and the pdf would load fast but with broken css.
Also when we try to move back to python2.7 then its internal server error and bench update
is also broken coz of pickle
.
Yes I got the same error too
How to solve this pickle error?