Session Start fail on web

One problem remains after updating to v13: Upon logging in, the page that opens presents a pop-up which simply says:

module 'public' has no attribute '__file__'

Updated the usual way, several sites (multi-tenant). All upgrades were done, a few issues cropped up but were resolved thanks to help on this forum, and the final updates and migrations all seemed to go without a hitch - except for the above error.

I’ve searched the forum and Google, and while one other post encountered the same error, it did not get any feedback and the person got rid of it by reinstalling the whole system. I can’t do that currently and prefer to know what causes it. I’ve looked through the node modules, I do not find anything named “public”. Either way I removed all and reset with “bench setup requirements”, which completed fine.

This error is not site-specific, it happens for ALL the sites.

Any advice where to find or update or fix that without needing to reinstall all of Frappe/ERPNext?

Could you share the browser console log output when this message pops up?

Certainly - Apologies, I should have included that from the start:

desk.js:42 Uncaught boot failed
startup @ desk.js:42
init @ desk.js:29
frappe.start_app @ desk.js:13
(anonymous) @ desk.js:24
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
J @ jquery.min.js:2
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Delta.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/AttributeMap.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Op.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Iterator.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Delta.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/AttributeMap.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Op.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for webpack://Quill/node_modules/quill-delta/dist/Iterator.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for https://erp.jubilingo.co.za/assets/js/socket.io.slim.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Are you on the dev branch of bench?

Unsure, but try this:
bench build && bench clear-cache && bench restart

If possible, post the output of the command.

[frappie@erp erp]$ bench build && bench clear-cache && bench restart
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
Retrieving assets...

✔ Downloaded Frappe assets from https://github.com/frappe/frappe/releases/download/v13.18.0/assets.tar.gz

Extracting assets...

✔ Restored js/frappe-web.min.js
✔ Restored js/web_form.min.js
✔ Restored js/frappe-recorder.min.js
✔ Restored js/form.min.js
✔ Restored js/frappe-recorder.min.js.map
✔ Restored js/libs.min.js
✔ Restored js/data_import_tools.min.js
✔ Restored js/bootstrap-4-web.min.js.map
✔ Restored js/desk.min.js
✔ Restored js/dialog.min.js.map
✔ Restored js/user_profile_controller.min.js
✔ Restored js/control.min.js.map
✔ Restored js/user_profile_controller.min.js.map
✔ Restored js/desk.min.js.map
✔ Restored js/barcode_scanner.min.js
✔ Restored js/checkout.min.js.map
✔ Restored js/list.min.js
✔ Restored js/bootstrap-4-web.min.js
✔ Restored js/control.min.js
✔ Restored js/dialog.min.js
✔ Restored js/web_form.min.js.map
✔ Restored js/frappe-web.min.js.map
✔ Restored js/moment-bundle.min.js
✔ Restored js/data_import_tools.min.js.map
✔ Restored js/form.min.js.map
✔ Restored js/barcode_scanner.min.js.map
✔ Restored js/checkout.min.js
✔ Restored js/report.min.js
✔ Restored js/list.min.js.map
✔ Restored js/report.min.js.map
✔ Restored css/email.css
✔ Restored css/desk.min.css
✔ Restored css/printview.css
✔ Restored css/frappe-web-b4.css
✔ Restored css/rollup.manifest.css
✔ Restored css/web_form.css
✔ Restored css/report.min.css
✔ Restored css/login.css
✔ Restored css-rtl/email.css
✔ Restored css-rtl/desk.min.css
✔ Restored css-rtl/printview.css
✔ Restored css-rtl/frappe-web-b4.css
✔ Restored css-rtl/web_form.css
✔ Restored css-rtl/report.min.css
✔ Restored css-rtl/login.css
✔ Application Assets Linked

yarn run v1.22.17
$ FRAPPE_ENV=production node rollup/build.js --skip_frappe
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building erpnext assets...

✔ Built js/erpnext-web.min.js
✔ Built js/bank-reconciliation-tool.min.js
✔ Built js/item-dashboard.min.js
✔ Built js/e-commerce.min.js
UNRESOLVED_IMPORT : 'vue/dist/vue.js' is imported by ../erpnext/erpnext/public/js/hub/marketplace.js, but could not be resolved – treating it as an external dependency
Cannot find some dependencies. You may have to run "bench setup requirements" to install them.

UNRESOLVED_IMPORT : 'vue/dist/vue.js' is imported by ../erpnext/erpnext/public/js/hub/vue-plugins.js, but could not be resolved – treating it as an external dependency
Cannot find some dependencies. You may have to run "bench setup requirements" to install them.

MISSING_GLOBAL_NAME : No name was provided for external module 'vue/dist/vue.js' in output.globals – guessing 'Vue'
✔ Built js/erpnext.min.js
✔ Built js/point-of-sale.min.js
✔ Built js/marketplace.min.js
✔ Built js/hierarchy-chart.min.js
✔ Built css/erpnext-web.css
✔ Built css/erpnext.css
✔ Built css-rtl/erpnext-web.css
✔ Built css/marketplace.css
✔ Built css-rtl/erpnext.css
✔ Built css-rtl/marketplace.css
✨  Done in 30.325s
Done in 39.62s.
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
Please specify --site sitename
[frappie@erp erp]$

I also got some dependency warnings when rebuilding npm, at least using the bench setup socketio (as part of the list of things I went over to try fix it).

I did not run the fix for it yet since I did not manually do this setup, just let bench do its update steps.

Output:

[frappie@erp erp]$ bench setup socketio
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
$ npm install socket.io redis express superagent cookie babel-core less chokidar                babel-cli babel-preset-es2015 babel-preset-es2016 babel-preset-es2017 babel-preset-babili
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated babel-preset-es2017@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated babel-preset-babili@0.1.4: babili has been renamed to babel-minify. Please update to babel-preset-minify
npm WARN deprecated babel-preset-es2016@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated

> core-js@2.6.12 postinstall /home/frappie/erp/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm WARN saveError ENOENT: no such file or directory, open '/home/frappie/erp/package.json'
npm WARN notsup Unsupported engine for redis@4.0.2: wanted: {"npm":">=7","typescript":">=4"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: redis@4.0.2
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/babel-cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for @node-redis/client@1.0.2: wanted: {"node":">=12"} (current: {"node":"10.24.1","npm":"6.14.12"})
npm WARN notsup Not compatible with your version of node/npm: @node-redis/client@1.0.2
npm WARN enoent ENOENT: no such file or directory, open '/home/frappie/erp/package.json'
npm WARN erp No description
npm WARN erp No repository field.
npm WARN erp No README data
npm WARN erp No license field.

+ babel-core@6.26.3
+ express@4.17.2
+ chokidar@3.5.2
+ cookie@0.4.1
+ less@4.1.2
+ socket.io@4.4.1
+ babel-cli@6.26.0
+ redis@4.0.2
+ babel-preset-es2015@6.24.1
+ superagent@7.0.2
+ babel-preset-es2017@6.24.1
+ babel-preset-babili@0.1.4
+ babel-preset-es2016@6.24.1
added 453 packages from 320 contributors and audited 456 packages in 86.4s

13 packages are looking for funding
  run `npm fund` for details

found 4 vulnerabilities (2 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details

Seems like you’re still on Python 2. You will have to migrate to Python 3.

bench migrate-env python3

I recommend you not to run this on production server, rather, do it on a backup/dev server and see if it migrates without any issues.

Is there something else I should do also?
I did the migration and it reports success, but then ran bench setup requirements directly after and it still looks like it is using python 2 - see log:

[frappie@erp erp]$ bench migrate-env python3
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn't match a supported version!
  RequestsDependencyWarning)
DEBUG:bench.utils:Clearing Redis Cache...
$ /usr/bin/redis-cli -p 13001 FLUSHALL
OK
DEBUG:bench.utils:Clearing Redis DataBase...
$ /usr/bin/redis-cli -p 13001 FLUSHDB
OK
DEBUG:bench.utils:Backing up Virtual Environment
DEBUG:bench.utils:Setting up a New Virtual /usr/bin/python3 Environment
$ /usr/bin/virtualenv --python /usr/bin/python3 /home/frappie/erp/env
Running virtualenv with interpreter /usr/bin/python3
Using base prefix '/usr'
  No LICENSE.txt / LICENSE found in source
New python executable in /home/frappie/erp/env/bin/python3
Also creating executable in /home/frappie/erp/env/bin/python
Installing setuptools, pip, wheel...
done.
$ /home/frappie/erp/env/bin/pip install -q -U -e apps/frappe -e apps/erpnext
DEBUG:bench.utils:Migration Successful to /usr/bin/python3
[frappie@erp erp]$ bench setup requirements
/usr/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.7) or chardet (2.2.1) doesn''t match a supported version!
  RequestsDependencyWarning)
Updating Python libraries...
$ ./env/bin/pip install -q -U pip
INFO:bench.app:installing frappe
$ ./env/bin/pip install -q -U -e ./apps/frappe
INFO:bench.app:installing erpnext
$ ./env/bin/pip install -q -U -e ./apps/erpnext
Updating node packages...
$ yarn install
yarn install v1.22.17
[1/4] Resolving packages...
success Already up-to-date.
$ yarn run snyk-protect
yarn run v1.22.17
$ snyk protect
Successfully applied Snyk patches

Done in 15.64s.
Done in 17.22s.
$ yarn install
yarn install v1.22.17
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.31s.
[frappie@erp erp]$

Could be because py2 might be the default version on your system. python --version can confirm that.

But again, that shouldn’t have been an issue since the venv is py3. Strange. Maybe try changing default to py3?

If I change the default python on my system to python3 then yum breaks completely - so that’s not an option.
The python3 in the virtual environment seems happy by itself after migrating, but it seems the bench command still invokes python 2. What I did learn from this exercise is that even when the system default was changed to python3, the bench still invoked python 2, as if it gets it from somewhere else.

I’ve now run out of time so probably have to try re-install everything.
What is the best way to clean reinstall bench and the frappe and erpnext apps?
Just delete all the files and re-run all the installs?

Hi,

I may have missed it , may we know the operating system and version ?

You did not miss it, I neglected to say - Apologies - It’s CentOS v. 7

It is solved now. It seems two things were missing from the updates, either is not correctly in the GIT repo, or doesn’t update with the version-13 branch (which I use), or perhaps simply failed for me.

Switching to my python env from my bench apps folder with:

$ source env/bin/activate

Then installed these two somehow missing modules:

(env) ... $ pip install atpublic

and

(env) ... $ pip install utils

Then did the usual bench setup requirements, bench update --patch, etc. and after completion it all worked.

Thank you kindly for the assistance offered.

2 Likes

Glad it worked out for you. Could you also share how you found the issue so that it’ll be helpful for someone facing similar problems in the future?

Certainly, though I thought it was clear from my last post already - but quite happy to elaborate some.

The problem manifested in seeing a web-page pop-up claiming “module ‘public’ has no attribute ‘file’”, and during building bench I also received an error that ended with “no module ‘utils’ found”.

Both of these seemed like Python error messages (and indeed were), so I had a long battle with the help of people here to try and sort out my Python version correctly, both for my system and the bench Python environment.

After several back and forwards on that (as can be read above in this thread) I did manage to ensure the Python versions were installed and updated correctly, but still the error remained.

I then tried to google which Python modules could be known as “public” and “utils”, or cause errors named so, and which Python versions they are from. This search led me to Python modules called “atpublic” and “utils” respectively, so I entered the Python environment on my server, and there installed those two modules with the command-lines mentioned in my previous post.

After that I exited the environment, re-did the bench compile and updates, and then it all worked.

I do not know why the modules “utils” and “atpublic” did not install with the bench preparation, I did several deletes and resets of the git files. Perhaps those modules are universal and my server just did not have them (I do run a somewhat barebones version of CentOS). If they are in the git repo and part of the bench initialization, then I do not understand why they were absent for me, but it’s probably worth looking into it.

I did find another post complaining of the exact same thing, but nobody could help him either and that person’s solution seems to have been solved with a full server re-install.

Either way, I hope if anyone else encounters this problem, my fix-steps above and in the previous post would be helpful to them.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.