mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-12 10:04:14 -05:00
start.sh not seeing uvicorn install in python3.11 in Ubuntu #328
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Tyler-Jay-Stevahn on GitHub (Feb 20, 2024).
Bug Report
Description
Bug Summary:
the following line in the start.sh file is causing issues for the manual installation not seeing the "uvicorn" package.
"WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" exec uvicorn main:app --host 0.0.0.0 --port "$PORT" --forwarded-allow-ips '*'"
Steps to Reproduce:
Fresh install of Ubuntu 20.04
Update everything & install nvidia drivers (open 545)
install ollama "https://ollama.com/download"
git clone repository for ollama web
install npm and python3.11 (Ubuntu comes with 3.10 by default)
npm run build command
sh start.sh command in terminal
Expected Behavior:
After installing and building the container the program should work and everything load fine.
Actual Behavior:
it doesn't work saying "exec uvicorn not found"
Environment
Reproduction Details
run "sh start.sh" from a git clone of this repository as mentioned above
Confirmation:
Logs and Screenshots
Browser Console Logs:
N/A
Docker Container Logs:
N/A
Screenshots (if applicable):
[Attach any relevant screenshots to help illustrate the issue]
Installation Method
Manual installation
Additional Information
when running the "sh start.sh" command on the terminal this is the output.
~/open-webui/backend$ sh start.sh
start.sh: 4: Bad substitution
No WEBUI_SECRET_KEY provided
Loading WEBUI_SECRET_KEY from .webui_secret_key
Traceback (most recent call last):
File "/home/snick/.local/bin/uvicorn", line 8, in
sys.exit(main())
^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/main.py", line 418, in main
run(
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run
server.run()
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/server.py", line 62, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
config.load()
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/config.py", line 458, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/snick/open-webui/backend/main.py", line 3, in
from fastapi import FastAPI, Request
ModuleNotFoundError: No module named 'fastapi'
A "python3.11 -m pip freeze" shows the fastapi is installed.
python3.11 -m pip freeze
aiohttp==3.9.3
aiosignal==1.3.1
annotated-types==0.6.0
anyio==4.3.0
archspec @ file:///croot/archspec_1697725767277/work
asgiref==3.7.2
attrs==23.2.0
av==10.0.0
backoff==2.2.1
bcrypt==4.1.2
beautifulsoup4==4.12.3
bidict==0.23.1
black==24.2.0
blinker==1.7.0
boltons @ file:///work/ci_py311/boltons_1677685195580/work
Brotli @ file:///work/ci_py311/brotli-split_1676830125088/work
build==1.0.3
cachetools==5.3.2
certifi==2024.2.2
cffi @ file:///croot/cffi_1700254295673/work
chardet==5.2.0
charset-normalizer==3.3.2
chroma-hnswlib==0.7.3
chromadb==0.4.22
click==8.1.7
coloredlogs==15.0.1
conda @ file:///croot/conda_1708369113911/work
conda-content-trust @ file:///croot/conda-content-trust_1693490622020/work
conda-libmamba-solver @ file:///croot/conda-libmamba-solver_1702997573971/work/src
conda-package-handling @ file:///croot/conda-package-handling_1690999929514/work
conda_package_streaming @ file:///croot/conda-package-streaming_1690987966409/work
cryptography @ file:///croot/cryptography_1702070282333/work
ctranslate2==3.24.0
dataclasses-json==0.6.4
dataclasses-json-speakeasy==0.5.11
Deprecated==1.2.14
distro @ file:///croot/distro_1701455004953/work
docx2txt==0.8
ecdsa==0.18.0
emoji==2.10.1
et-xmlfile==1.1.0
fastapi==0.109.2 <---------------------------------------- Here
faster-whisper==0.10.0
filelock==3.13.1
filetype==1.2.0
Flask==3.0.2
Flask-Cors==4.0.0
flatbuffers==23.5.26
frozenlist==1.4.1
fsspec==2024.2.0
google-auth==2.28.0
googleapis-common-protos==1.62.0
greenlet==3.0.3
grpcio==1.60.1
h11==0.14.0
httptools==0.6.1
huggingface-hub==0.20.3
humanfriendly==10.0
idna==3.6
importlib-metadata==6.11.0
importlib-resources==6.1.1
itsdangerous==2.1.2
Jinja2==3.1.3
joblib==1.3.2
jsonpatch==1.33
jsonpath-python==1.0.6
jsonpointer==2.4
kubernetes==29.0.0
langchain==0.1.8
langchain-community==0.0.21
langchain-core==0.1.24
langdetect==1.0.9
langsmith==0.1.2
libmambapy @ file:///croot/mamba-split_1698782620632/work/libmambapy
lxml==5.1.0
Markdown==3.5.2
MarkupSafe==2.1.5
marshmallow==3.20.2
menuinst @ file:///croot/menuinst_1702390294373/work
mmh3==4.1.0
monotonic==1.6
mpmath==1.3.0
multidict==6.0.5
mypy-extensions==1.0.0
networkx==3.2.1
nltk==3.8.1
numpy==1.26.4
nvidia-cublas-cu12==12.1.3.1
nvidia-cuda-cupti-cu12==12.1.105
nvidia-cuda-nvrtc-cu12==12.1.105
nvidia-cuda-runtime-cu12==12.1.105
nvidia-cudnn-cu12==8.9.2.26
nvidia-cufft-cu12==11.0.2.54
nvidia-curand-cu12==10.3.2.106
nvidia-cusolver-cu12==11.4.5.107
nvidia-cusparse-cu12==12.1.0.106
nvidia-nccl-cu12==2.19.3
nvidia-nvjitlink-cu12==12.3.101
nvidia-nvtx-cu12==12.1.105
oauthlib==3.2.2
onnxruntime==1.17.0
openpyxl==3.1.2
opentelemetry-api==1.22.0
opentelemetry-exporter-otlp-proto-common==1.22.0
opentelemetry-exporter-otlp-proto-grpc==1.22.0
opentelemetry-instrumentation==0.43b0
opentelemetry-instrumentation-asgi==0.43b0
opentelemetry-instrumentation-fastapi==0.43b0
opentelemetry-proto==1.22.0
opentelemetry-sdk==1.22.0
opentelemetry-semantic-conventions==0.43b0
opentelemetry-util-http==0.43b0
overrides==7.7.0
packaging==23.2
pandas==2.2.0
passlib==1.7.4
pathspec==0.12.1
peewee==3.17.1
pillow==10.2.0
platformdirs==4.2.0
pluggy @ file:///work/ci_py311/pluggy_1676822818071/work
posthog==3.4.1
protobuf==4.25.3
pulsar-client==3.4.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycosat @ file:///croot/pycosat_1696536503704/work
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pydantic==2.6.1
pydantic_core==2.16.2
PyJWT==2.8.0
pyOpenSSL @ file:///croot/pyopenssl_1690223430423/work
pypandoc==1.13
pypdf==4.0.2
PyPika==0.48.9
pyproject_hooks==1.0.0
PySocks @ file:///work/ci_py311/pysocks_1676822712504/work
python-dateutil==2.8.2
python-dotenv==1.0.1
python-engineio==4.9.0
python-iso639==2024.2.7
python-jose==3.3.0
python-magic==0.4.27
python-multipart==0.0.9
python-socketio==5.11.1
pytz==2024.1
pyxlsb==1.0.10
PyYAML==6.0.1
rapidfuzz==3.6.1
regex==2023.12.25
requests==2.31.0
requests-oauthlib==1.3.1
rsa==4.9
ruamel.yaml @ file:///work/ci_py311/ruamel.yaml_1676838772170/work
safetensors==0.4.2
scikit-learn==1.4.1.post1
scipy==1.12.0
sentence-transformers==2.3.1
sentencepiece==0.2.0
simple-websocket==1.0.0
six==1.16.0
sniffio==1.3.0
soupsieve==2.5
SQLAlchemy==2.0.27
starlette==0.36.3
sympy==1.12
tabulate==0.9.0
tenacity==8.2.3
threadpoolctl==3.3.0
tokenizers==0.15.2
torch==2.2.0
tqdm==4.66.2
transformers==4.37.2
triton==2.2.0
truststore @ file:///croot/truststore_1695244293384/work
typer==0.9.0
typing-inspect==0.9.0
typing_extensions==4.9.0
tzdata==2024.1
unstructured==0.12.4
unstructured-client==0.18.0
urllib3==2.2.1
uuid==1.30
uvicorn==0.27.1
uvloop==0.19.0
watchfiles==0.21.0
websocket-client==1.7.0
websockets==12.0
Werkzeug==3.0.1
wrapt==1.16.0
wsproto==1.2.0
xlrd==2.0.1
yarl==1.9.4
zipp==3.17.0
zstandard @ file:///work/ci_py311_2/zstandard_1679339489613/work
I'm not sure why it works but changing that line in start.sh to the following line seems to work. You have to run it by saying "sh start.sh" in a console/terminal window. The right click and run as program option doesn't seem to work.
"WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" exec python3.11 -m uvicorn main:app --reload --host 0.0.0.0 --port "$PORT" --forwarded-allow-ips '*'"
Note
If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
@justinh-rahb commented on GitHub (Feb 20, 2024):
Should be noted that this is not recommended mode of operation, and the behaviour may differ from system to system (which is why we use Docker, because then we know we're only dealing with what we set as the base image).
That said, did you try running it with
bash start.shunmodified? This is how it's invoked by the container. Note the usage of bash not sh. If it's still not working, I'd look at whyuvicornseemingly cannot be found in your$PATH. Would also be good to know if there's any virtual environment of any sort involved (venv, Conda, VirtualEnv, etc.)? If not, perhaps try one of those too.@Tyler-Jay-Stevahn commented on GitHub (Feb 20, 2024):
Reverting back to the original start.sh file and running "bash start.sh" gives the following error. I'm not really sure why the fastapi packages gives issues here. Running "bash start.sh" doesn't seem to cause any issues with the updated line.
bash start.sh
No WEBUI_SECRET_KEY provided
Loading WEBUI_SECRET_KEY from .webui_secret_key
Traceback (most recent call last):
File "/home/snick/.local/bin/uvicorn", line 8, in
sys.exit(main())
^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/main.py", line 418, in main
run(
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run
server.run()
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/server.py", line 62, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
config.load()
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/config.py", line 458, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/importer.py", line 24, in import_from_string
raise exc from None
File "/home/snick/.local/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/snick/open-webui/backend/main.py", line 3, in
from fastapi import FastAPI, Request
ModuleNotFoundError: No module named 'fastapi'