slippersheepig/chatgpt-web

RuntimeError: can't start new thread 请作者大大帮忙看看,启动时出现错误

Closed this issue · 2 comments

我的 docker-compose.yml配置如下

cat docker-compose.yml

version: "2"
services:
  chatgpt:
    image: sheepgreen/chatgpt-web
    container_name: webchat
    volumes:
      - ./.env:/chatgpt-web/.env
#      - ./chat.html:/chatgpt-web/templates/chat.html 
    ports:
      - "8890:8088"
    restart: always

错误日志如下:
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, 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 "/chatgpt-web/main.py", line 11, in
chatbot = Chatbot(api_key=config["OPENAI_API_KEY"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/revChatGPT/V3.py", line 69, in init
if self.get_token_count("default") > self.max_tokens:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/revChatGPT/V3.py", line 105, in get_token_count
encoding = tiktoken.encoding_for_model(self.engine)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken/model.py", line 73, in encoding_for_model
return get_encoding(encoding_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken/registry.py", line 63, in get_encoding
enc = Encoding(**constructor())
^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken_ext/openai_public.py", line 64, in cl100k_base
mergeable_ranks = load_tiktoken_bpe(
^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken/load.py", line 114, in load_tiktoken_bpe
contents = read_file_cached(tiktoken_bpe_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken/load.py", line 46, in read_file_cached
contents = read_file(blobpath)
^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/tiktoken/load.py", line 24, in read_file
return requests.get(blobpath).content
^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/connection.py", line 363, in connect
self.sock = conn = self._new_conn()
^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/connection.py", line 174, in _new_conn
conn = connection.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/urllib3/util/connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/_socketcommon.py", line 247, in getaddrinfo
addrlist = get_hub().resolver.getaddrinfo(host, port, family, type, proto, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/resolver/thread.py", line 63, in getaddrinfo
return self.pool.apply(_socket.getaddrinfo, args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/pool.py", line 161, in apply
return self.spawn(func, *args, **kwds).get()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/threadpool.py", line 546, in spawn
self.adjust()
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/threadpool.py", line 492, in adjust
self._adjust_step()
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/threadpool.py", line 472, in _adjust_step
self._add_thread()
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/threadpool.py", line 499, in _add_thread
self._WorkerGreenlet(self)
File "/home/appuser/.local/lib/python3.11/site-packages/gevent/threadpool.py", line 106, in init
start_new_thread(self._begin, ())
RuntimeError: can't start new thread
[2023-03-16 09:16:36 +0000] [6] [INFO] Worker exiting (pid: 6)
[2023-03-16 09:16:36 +0000] [1] [INFO] Shutting down: Master
[2023-03-16 09:16:36 +0000] [1] [INFO] Reason: Worker failed to boot.

看起来应该是连接作者代理服务器出问题了,要么是你的网络问题(含运营商线路问题),要么作者服务器ban了你的IP段
刚我用作者的代码重新构建了docker,也可以拉最新镜像再试试

好的,我再试试,谢谢。可能是ip被ban了吧,我的服务器是海外的ip.