Skip to content

Web App does not start: ModuleNotFoundError: No module named 'main' #2034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MiguelElGallo opened this issue Oct 13, 2024 · 4 comments
Open

Comments

@MiguelElGallo
Copy link

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Deploy with all default settings, web app never starts full error:

2024-10-13T13:48:00.971279417Z    _____
2024-10-13T13:48:00.971322417Z   /  _  \ __________ _________   ____
2024-10-13T13:48:00.971328417Z  /  /_\  \\___   /  |  \_  __ \_/ __ \
2024-10-13T13:48:00.971332817Z /    |    \/    /|  |  /|  | \/\  ___/
2024-10-13T13:48:00.971336717Z \____|__  /_____ \____/ |__|    \___  >
2024-10-13T13:48:00.971341317Z         \/      \/                  \/
2024-10-13T13:48:00.971345417Z A P P   S E R V I C E   O N   L I N U X
2024-10-13T13:48:00.971349117Z
2024-10-13T13:48:00.971352817Z Documentation: http://aka.ms/webapp-linux
2024-10-13T13:48:00.971356517Z Python 3.11.8
2024-10-13T13:48:00.971360317Z Note: Any data outside '/home' is not persisted
2024-10-13T13:48:04.826217047Z Starting OpenBSD Secure Shell server: sshd.
2024-10-13T13:48:05.012929880Z WEBSITES_INCLUDE_CLOUD_CERTS is not set to true.
2024-10-13T13:48:05.168098955Z Site's appCommandLine: python3 -m gunicorn main:app
2024-10-13T13:48:05.172764878Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'python3 -m gunicorn main:app'
2024-10-13T13:48:05.225727543Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2024-10-13T13:48:05.225759643Z Could not find operation ID in manifest. Generating an operation id...
2024-10-13T13:48:05.225766943Z Build Operation ID: 9fe5aa84-0ecf-4a25-a1c7-4549b102b5e1
2024-10-13T13:48:05.557206399Z Oryx Version: 0.2.20240501.1, Commit: f83f88d3cfb8bb6d3e2765e1dcd218eb0814a095, ReleaseTagName: 20240501.1
2024-10-13T13:48:05.589276460Z Writing output script to '/opt/startup/startup.sh'
2024-10-13T13:48:05.667132649Z WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.
2024-10-13T13:48:05.673249779Z WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.
2024-10-13T13:48:07.141512516Z [2024-10-13 13:48:07 +0000] [63] [INFO] Starting gunicorn 22.0.0
2024-10-13T13:48:07.157861197Z [2024-10-13 13:48:07 +0000] [63] [INFO] Listening at: http://0.0.0.0:8000 (63)
2024-10-13T13:48:07.164031928Z [2024-10-13 13:48:07 +0000] [63] [INFO] Using worker: sync
2024-10-13T13:48:07.196862292Z [2024-10-13 13:48:07 +0000] [71] [INFO] Booting worker with pid: 71
2024-10-13T13:48:07.232056568Z [2024-10-13 13:48:07 +0000] [71] [ERROR] Exception in worker process
2024-10-13T13:48:07.232223069Z Traceback (most recent call last):
2024-10-13T13:48:07.232230969Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
2024-10-13T13:48:07.232236269Z     worker.init_process()
2024-10-13T13:48:07.232240169Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
2024-10-13T13:48:07.232244469Z     self.load_wsgi()
2024-10-13T13:48:07.232283769Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2024-10-13T13:48:07.232290869Z     self.wsgi = self.app.wsgi()
2024-10-13T13:48:07.232294669Z                 ^^^^^^^^^^^^^^^
2024-10-13T13:48:07.232298569Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
2024-10-13T13:48:07.232302569Z     self.callable = self.load()
2024-10-13T13:48:07.232306469Z                     ^^^^^^^^^^^
2024-10-13T13:48:07.232310369Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2024-10-13T13:48:07.232314369Z     return self.load_wsgiapp()
2024-10-13T13:48:07.232318170Z            ^^^^^^^^^^^^^^^^^^^
2024-10-13T13:48:07.232322170Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2024-10-13T13:48:07.232326170Z     return util.import_app(self.app_uri)
2024-10-13T13:48:07.232330070Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-13T13:48:07.232333870Z   File "/opt/python/3/lib/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
2024-10-13T13:48:07.232337970Z     mod = importlib.import_module(module)
2024-10-13T13:48:07.232359970Z           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-13T13:48:07.232366270Z   File "/opt/python/3/lib/python3.11/importlib/__init__.py", line 126, in import_module
2024-10-13T13:48:07.232370470Z     return _bootstrap._gcd_import(name[level:], package, level)
2024-10-13T13:48:07.232374370Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-13T13:48:07.232378270Z   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
2024-10-13T13:48:07.232383270Z   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
2024-10-13T13:48:07.232387470Z   File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
2024-10-13T13:48:07.232391570Z ModuleNotFoundError: No module named 'main'
2024-10-13T13:48:07.232395470Z [2024-10-13 13:48:07 +0000] [71] [INFO] Worker exiting (pid: 71)
2024-10-13T13:48:07.599376504Z [2024-10-13 13:48:07 +0000] [63] [ERROR] Worker (pid:71) exited with code 3
2024-10-13T13:48:07.599481604Z [2024-10-13 13:48:07 +0000] [63] [ERROR] Shutting down: Master
2024-10-13T13:48:07.599489104Z [2024-10-13 13:48:07 +0000] [63] [ERROR] Reason: Worker failed to boot.

Any log messages given by the failure

2024-10-13T13:48:07.232391570Z ModuleNotFoundError: No module named 'main'

Expected/desired behavior

Web App should start

OS and Version?

CodeSpaces

azd version?

azd version 1.10.2 (commit 84ea22048b9a1c167bc4ae2095cc7f91798ef11e)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

@MiguelElGallo
Copy link
Author

Seems same as #1864. Maybe @zedhaque or @pamelafox cloud have a better opinion what is happening here.
Thanks!

@jeannot-prvlimburg
Copy link

Just randomly ran into this issue as well.

ModuleNotFoundError: No module named 'main'

@jeannot-prvlimburg
Copy link

Simply retrying with azd up resolved the issue for me.

@nickmachairas
Copy link

You probably deployed from within the app directory. Try deploying again, make sure you run azd deploy from the root directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants