欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 创投人物 > 非docker安装open-webui连接ollama实现deepseek本地使用,集成其他openai模型,常见启动报错问题解决。

非docker安装open-webui连接ollama实现deepseek本地使用,集成其他openai模型,常见启动报错问题解决。

2025/2/21 3:15:20 来源:https://blog.csdn.net/weixin_48470176/article/details/145601275  浏览:    关键词:非docker安装open-webui连接ollama实现deepseek本地使用,集成其他openai模型,常见启动报错问题解决。

环境介绍和注意事项

  1. 建议使用conda虚拟环境(如何安装miniconda不是这里的重点,请自行学习安装)
  2. python3.11(注意一定要这个版本的python)
    mini conda各个操作系统侵华镜像下载地址:
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/
  3. ollama 环境(非必须,这里注意用来启动deepseek,ollama的离线安装另外的文章整理)

注意事项

  1. 目前(2025-2-13)open-webui 推荐ython3.11

官方原文:

Python 3.11 is the development environment. Python 3.12 seems to work but has not been thoroughly tested. Python 3.13 is entirely untested—use at your own risk.

翻译:

Python 3.11 是开发环境。Python 3.12 看起来可以工作,但尚未经过彻底测试。Python 3.13 完全没有经过测试——使用需自行承担风险。

事实上本人win10系统使用python3.12版本下载open-webui都没有成功,所以保守起见用python3.11版本比较稳妥。

  1. open-webui的相关依赖特别多,下载会很耗时,建议一定要使用虚拟环境和耐心等待。其他各自安装或者启动失败的大多都是这个原因。

准备

  1. 使用coda 创建虚拟环境
conda create -n open-webui python=3.11
  1. 激活虚拟环境
 conda activate open-webui

或者使用venv创建虚拟环境(不推荐,除非你自己安装的python3.11版本)

python -m venv open-webui
open-webui/Script/activate
  1. 安装 open-webui
pip install open-webui
#或者推荐使用阿里源镜像
pip install open-webui -i https://mirrors.aliyun.com/pypi/simple/
  1. 启动open-webui

注意: 如何 ollama和 open-webui不在同一台机器上或修改了ollama的默认端口,需要设置如下环境变量

# 192.168.1.14 是你的ollama地址,默认端口是11434,如果有修改替换成你自己的。
OLLAMA_BASE_URL = "http://192.168.1.14:11434"

或者修改open-webui的配置文件源代码。
config.py,搜索OLLAMA_BASE_URL 修改即可
config.py的路径在安装的conda虚拟环境的openwebui下面conda虚拟环境路径\Lib\site-packages\open_webui,以我本机为例:

D:\install\miniconda3\envs\pyp311\Lib\site-packages\open_webui

代码截图:
修改"http://localhost:11434"为你自己的ollama地址和端口。
在这里插入图片描述
启动服务

open-webui serve 
# 默认8080,可以指定端口
open-webui serve --port 8081 

启动之后会根据huggingface.io联网下载一个embedding模型,如果没有科学上网会出现报错,会影响RAG,不影响对话功能,看到最后能出现端口显示即说明成功。
在这里插入图片描述
当然也可以解决这个问题,可以在modelscope下载
https://www.modelscope.cn/models/sentence-transformers/all-MiniLM-L6-v2

通过修改源码:路径在[miniconda地址]/open-webui/tree/main/backend/open_webui/retrieval/utils.py
的get_model_path方法
将mode修改为刚刚下载的模型路径:

model="C:你的下载路径\sentence-transformers\all-MiniLM-L6-v2"

open-webui的使用和配置

启动成功后首次登录需要创建管理员账号,使用邮箱登录。

  1. 配置新用户注册,默认是关闭的。
    在这里插入图片描述
    在这里插入图片描述
  2. 除了ollama模型外还可以配置其他的openai模型。
    点击页面-管理员-设置-外部链接
    在这里插入图片描述
    在这里插入图片描述
    在这里可以使用你自己的openai模型,例如我自己使用的是智谱的,填写url和你申请的秘钥,还有模型名称,GLM-4-FLASH目前是免费使用的,如果大家想使用可以在智谱开发平台或者其他开源平台申请。
    还有更多设置如:选择默认模型以及更多玩法见最后的参考链接。

最后选择模型开始聊天吧!
在这里插入图片描述

其他记录参考

安装的记录:

Successfully built docx2txt peewee compressed-rtf pypika red-black-tree-mod langdetect win-unicode-console
Installing collected packages: win-unicode-console, webencodings, wcwidth, sentencepiece, red-black-tree-mod, pyxlsb, pywin32, pytz, pypika, pydub, pyclipper, py-partiql-parser, peewee, passlib, mpmath, monotonic, flatbuffers, filetype, fake-useragent, Events, ebcdic, easygui, durationpy, docx2txt, compressed-rtf, bitarray, appdirs, aiocache, zipp, xxhash, xmltodict, XlsxWriter, xlrd, wrapt, websockets, websocket-client, validators, urllib3, uritemplate, ujson, tzdata, typing-extensions, threadpoolctl, tenacity, sympy, soupsieve, sniffio, smmap, six, shellingham, safetensors, restrictedpython, regex, redis, rapidfuzz, PyYAML, pytube, python-multipart, python-magic, python-iso639, python-dotenv, pyreadline3, pyproject_hooks, pypdf, pyparsing, pypandoc, pymysql, pyjwt, pygments, pycparser, pyasn1, pyarrow, psycopg2-binary, psutil, protobuf, propcache, primp, portalocker, pluggy, platformdirs, Pillow, pathspec, packaging, overrides, orjson, opentelemetry-util-http, olefile, oauthlib, numpy, ninja, networkx, nest-asyncio, mypy-extensions, multidict, mmh3, mdurl, MarkupSafe, markdown, lxml, lark, jsonpointer, jsonpath-python, joblib, jmespath, jiter, itsdangerous, iniconfig, importlib-resources, idna, hyperframe, httpx-sse, httptools, hpack, h11, grpcio, greenlet, google-crc32c, ftfy, fsspec, frozenlist, fonttools, filelock, eval-type-backport, et-xmlfile, emoji, einops, dnspython, distro, dill, defusedxml, colorclass, colorama, charset-normalizer, chardet, certifi, cachetools, blinker, bidict, bcrypt, backoff, av, attrs, async-timeout, asgiref, annotated-types, aiohappyeyeballs, aiofiles, yarl, wsproto, Werkzeug, tzlocal, typing-inspect, tqdm, sqlalchemy, Shapely, scipy, rsa, requests, rank-bm25, python-pptx, python-dateutil, pytest, pymongo, pymdown-extensions, pydantic-core, pyasn1-modules, proto-plus, pgvector, opentelemetry-proto, openpyxl, opencv-python-headless, opencv-python, multiprocess, marshmallow, markdown-it-py, Mako, ldap3, langdetect, jsonpatch, Jinja2, importlib-metadata, humanfriendly, httplib2, httpcore, html5lib, h2, grpcio-tools, googleapis-common-protos, google-resumable-media, gitdb, fs, fpdf2, ecdsa, deprecated, ctranslate2, click, chroma-hnswlib, cffi, build, beautifulsoup4, anyio, aiosignal, youtube-transcript-api, watchfiles, uvicorn, torch, tiktoken, starlette, soundfile, simple-websocket, scikit-learn, rich, responses, requests-toolbelt, requests-oauthlib, python-oxmsg, python-jose, pytest-docker, pydantic, posthog, peewee-migrate, pandas, opentelemetry-exporter-otlp-proto-common, opentelemetry-api, opensearch-py, nltk, huggingface-hub, httpx, grpcio-status, google-auth, gitpython, gcp-storage-emulator, flask, duckduckgo-search, docker, dataclasses-json, cryptography, coloredlogs, botocore, black, argon2-cffi-bindings, apscheduler, alembic, aiohttp, unstructured-client, typer, tokenizers, s3transfer, python-engineio, pymilvus, pydantic-settings, opentelemetry-semantic-conventions, opentelemetry-instrumentation, openai, onnxruntime, msoffcrypto-tool, lang

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词