'Session Start Failed No module named pdfkit' on bench migrate-env python3, ERPN v11

Running bench migrate-env python3 on bench with Frappe and ERPNext on master (v11) completed successfully, but I’m blocked by this error.

I’ve tried bench setup requirements but that didn’t help. I’ll try pip install pdfkit in bench’s virtual environment now.

And the pip command didn’t help.

~/frappe-bench$  env/bin/pip3 install pdfkit
Requirement already satisfied: pdfkit in ./env/lib/python3.5/site-packages (0.6.1)
~/frappe-bench$  env/bin/pip install pdfkit
Requirement already satisfied: pdfkit in ./env/lib/python3.5/site-packages (0.6.1)

I ran bench update after this:

~/frappe-bench$ 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/python3.5/site-packages (5.4.1)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe
 * 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 master
From https://github.com/frappe/erpnext
 * 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 (19.0.2)
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/frappe 
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext 
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.13.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.47s.
Backing up sites...
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, 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/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/core.py", line 696, in main
    _verify_python3_env()
  File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/click/_unicodefun.py", line 124, in _verify_python3_env
    ' mitigation steps.' + extra
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.

This system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8

Click discovered that you exported a UTF-8 locale
but the locale system could not pick up from it because
it does not exist.  The exported locale is "en_US.UTF-8" but it
is not supported
~/frappe-bench$ export LC_ALL=C.UTF-8
~/frappe-bench$ export LANG=C.UTF-8
~/frappe-bench$ 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/python3.5/site-packages (5.4.1)
INFO:bench.app:pulling frappe
INFO:bench.utils:git pull  upstream master
From https://github.com/frappe/frappe
 * 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 master
From https://github.com/frappe/erpnext
 * 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 (19.0.2)
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
INFO:bench.app:installing frappe
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/frappe 
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext 
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.13.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.47s.
Backing up sites...
Patching sites...
Migrating site1.local
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
yarn run v1.13.0
$ 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/web_form.min.js
✔ Built js/form.min.js
✔ Built js/list.min.js
✔ Built js/print_format_v3.min.js
✔ Built js/dialog.min.js
✔ Built js/chat.js
✔ Built js/desk.min.js
✔ Built css/frappe-rtl.css
✔ Built css/report.min.css
✔ Built css/list.min.css
✔ Built css/module.min.css
✔ Built css/form.min.css
✔ Built frappe/css/email.css
✔ Built css/web_form.css
✔ Built css/frappe-web.css
✔ Built css/desk.min.css
✔ Built js/control.min.js
✔ Built js/frappe-web.min.js
✔ Built js/report.min.js
✨  Done in 23.472s

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 js/marketplace.min.js
✔ Built css/marketplace.css
✔ Built css/erpnext.css
✨  Done in 8.781s
Done in 33.23s.
INFO:bench.utils:sudo supervisorctl restart frappe-bench-workers: frappe-bench-web:
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
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
()

Now, I’m blocked by Session Start Failed 'ascii' codec can't decode byte 0xd0 in position 681987: ordinal not in range(128):

Can you please post the error in browser’s console (f12) here?

quill Overwriting modules/mention with 
Mention()
​
length: 2
​
name: "Mention"
​
prototype: {…}
​​
constructor: function Mention()​​
containerBottomIsNotVisible: function containerBottomIsNotVisible()​​
containerRightIsNotVisible: function containerRightIsNotVisible()​​
downHandler: function downHandler()​​
escapeHandler: function escapeHandler()​​
getItemData: function getItemData()​​
hasValidChars: function hasValidChars()​​
hideMentionList: function hideMentionList()​​
highlightItem: function highlightItem()​​
nextItem: function nextItem()​​
onContainerMouseMove: function onContainerMouseMove()​​
onItemClick: function onItemClick()​​
onItemMouseEnter: function onItemMouseEnter()​​
onSelectionChange: function onSelectionChange()​​
onSomethingChange: function onSomethingChange()​​
onTextChange: function onTextChange()​​
prevItem: function prevItem()​​
renderList: function renderList()​​
selectHandler: function selectHandler()​​
selectItem: function selectItem()​​
setMentionContainerPosition: function setMentionContainerPosition()​​
showMentionList: function showMentionList()​​
upHandler: function upHandler()​​
<prototype>: Object { … }
​
<prototype>: ()
​​
apply: function apply()
​​
arguments: null
​​
bind: function bind()
​​
call: function call()
​​
caller: null
​​
constructor: function Function()
​​
length: 0
​​
name: ""
​​
toSource: function toSource()
​​
toString: function toString()
​​
Symbol(Symbol.hasInstance): function Symbol.hasInstance()
​​
<get arguments()>: function arguments()
​​
<set arguments()>: function arguments()
​​
<get caller()>: function caller()
​​
<set caller()>: function caller()
​​
<prototype>: Object { … }
logger.js:11:20
uncaught exception: boot failed

@snv, I do want to help document this bug, but I do need to get this system ready. If there’s anything you want like the copy of the bench directory and SQL dump, please say so. I’m going to wipe it out and redo it with Python 3 to begin with (there’s a flag for Python 3 in the installation script, right?); I really need to get this system ready by this week at least.

For context, this was setup using the install script (ran with python3 because I thought it’d setup bench with the Python used to run installer) a week before v11 release. After v11 upgrade it worked fine without issue except for Print Format Builder not loading for whatever reason; that’s why I decided to bench setup --reset and change env to python3 to experiment.

  • The one in yellow is a warning the can be ignored.
  • The exception causing boot failure is uncaught. We need to dig deeper to find the cause of the problem.
  • The print format builder issue has already been fixed before 12 days.
  • Let me know how reinstalling goes.

I already did bench update after facing the Builder issue, so I don’t know why it wasn’t fixed in my case. But well, I already broke it so further ponderance is not worth the time.

I shall run install.py with --python python3 argument this time around.