ModuleNotFoundError: No module named 'books' ,I used it with great enthusiasm, but couldn't even create an APP.

I used it with great enthusiasm, but couldn’t even create an APP.

I was not a professional Python programmer, and I just wanted to find a full-stack framework that was easy to use. Until I found Frappe, which was obviously much more powerful and easy to use than Django, I started installing and configuring Frappe with great enthusiasm and expectation. I was in China, but due to network problems, it was very inconvenient to access Github. However, I overcame various obstacles and successfully installed and ran version12, version13 and Version 14 Beta through compilation. After comparison, I confirmed that using Version 13, the previous steps went smoothly until I was ready to create a new APP. According to the document, I performed the following steps:

Note: My system environment ubuntu 20.04 LTS, non Docker way to install

cd Xindeng. club (My Bench directory)

bench new-app books

The command executes successfully, and the books directory and files are correctly generated in the apps directory.

bench --site app.xindeng.club install-app books

`ModuleNotFoundError
ModuleNotFoundError: No module named ‘books’

Traceback (most recent call last)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/app.py”, line 78, in application
response = frappe.website.render.render()
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/website/render.py”, line 54, in render
elif is_static_file(path):
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/website/render.py”, line 127, in is_static_file
file_path = frappe.get_app_path(app, “www”) + “/” + path
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1218, in get_app_path
return get_pymodule_path(app_name, *joins)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1235, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).file or “”), *joins)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1191, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

During handling of the above exception, another exception occurred:
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/middlewares.py”, line 18, in call
return super(StaticDataMiddleware, self).call(environ, start_response)
File “/home/ubuntu/xindeng.club/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py”, line 220, in call
return self.app(environ, start_response)
File “/home/ubuntu/xindeng.club/env/lib/python3.8/site-packages/werkzeug/middleware/shared_data.py”, line 220, in call
return self.app(environ, start_response)
File “/home/ubuntu/xindeng.club/env/lib/python3.8/site-packages/werkzeug/local.py”, line 231, in application
return ClosingIterator(app(environ, start_response), self.cleanup)
File “/home/ubuntu/xindeng.club/env/lib/python3.8/site-packages/werkzeug/wrappers/base_request.py”, line 237, in application
resp = f(*args[:-2] + (request,))
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/app.py”, line 90, in application
response = handle_exception(e)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/app.py”, line 294, in handle_exception
response = frappe.website.render.render(“message”, http_status_code=http_status_code)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/website/render.py”, line 54, in render
elif is_static_file(path):
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/website/render.py”, line 127, in is_static_file
file_path = frappe.get_app_path(app, “www”) + “/” + path
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1218, in get_app_path
return get_pymodule_path(app_name, *joins)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1235, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).file or “”), *joins)
File “/home/ubuntu/xindeng.club/apps/frappe/frappe/init.py”, line 1191, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import

File “”, line 991, in _find_and_load

File “”, line 973, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘books’`

I’ve tried many times, whether it’s Version 14 beta or Version 13, and up to now, no APP has been created. I’ve searched many of the same forum posts showing ModuleNotFoundError and tried many suggestions, but until now, One goal of creating an APP has still not been achieved! Who can tell me what the correct procedure should be?

from your bench directory
try

./env/bin/pip install -e ./apps/books

then

bench setup requirements

and see if this solve your problem

Thank you for your reply!

I performed the above operation according to the steps you said, but the result is still ModuleNotFoundError.

I suspect it may be the problem of Python environment, because I used Ubuntu20.04 and python2 and Python3 versions exist at the same time, I suspect it is the problem of environment.

I will continue to try to install configuration from zero until this issue is resolved, thank you!

When you install Frappe Framework, it creates a Python Virtual Environment in a directory named 'env' inside the Bench directory.

To learn which version of Python the Frappe framework was installed with, type this from your bench directory:

./env/bin/python --version

Thank you for your reply. I have checked before and confirmed that python3.8 is used 。