Skip to content
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

Error: class uri 'uvicorn.workers.UvicornWorker' invalid or not found: #3

Closed
vparames86 opened this issue Jan 6, 2021 · 2 comments
Closed

Comments

@vparames86
Copy link

vparames86 commented Jan 6, 2021

I had built a FastAPI Azure webapp and used your idea of passing "gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app" in startup command, but I keep getting the following error.

Error: class uri 'uvicorn.workers.UvicornWorker' invalid or not found:
2021-01-06T04:40:40.709590602Z
2021-01-06T04:40:40.709594402Z [Traceback (most recent call last):
2021-01-06T04:40:40.709598102Z File "/opt/python/3.7.9/lib/python3.7/site-packages/gunicorn/util.py", line 99, in load_class
2021-01-06T04:40:40.709602202Z mod = importlib.import_module('.'.join(components))
2021-01-06T04:40:40.709605802Z File "/opt/python/3.7.9/lib/python3.7/importlib/init.py", line 127, in import_module
2021-01-06T04:40:40.709609603Z return _bootstrap._gcd_import(name[level:], package, level)
2021-01-06T04:40:40.709613203Z File "", line 1006, in _gcd_import
2021-01-06T04:40:40.709617203Z File "", line 983, in _find_and_load
2021-01-06T04:40:40.709629603Z File "", line 953, in _find_and_load_unlocked
2021-01-06T04:40:40.709633503Z File "", line 219, in _call_with_frames_removed
2021-01-06T04:40:40.709637103Z File "", line 1006, in _gcd_import
2021-01-06T04:40:40.709640903Z File "", line 983, in _find_and_load
2021-01-06T04:40:40.709644503Z File "", line 965, in _find_and_load_unlocked
2021-01-06T04:40:40.709648303Z ModuleNotFoundError: No module named 'uvicorn'

I have a "requirements.txt" file like you have in your project and have included both gunicorn and unicorn libraries, but for some reason the I feel the webapp doesn't pick the gunicorn instance from the virtual environment. Have you faced anything like this?

@windson
Copy link
Owner

windson commented Jan 6, 2021

Remove version pinning in the requirements.txt for Gunicorn and try to install it again.
Let me know what happens.
Alternatively, I think you better try with python version 3.8 or later based on the discussion that went here

@windson windson closed this as completed Jan 15, 2021
@windson
Copy link
Owner

windson commented Jan 15, 2021

Closed due to inactivity

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

2 participants