收藏
回答

云托管构建失败。

https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/guide/service/faq.html

本地构建可以通过。

云托管构建服务时在pip install 时报错:

完整报错信息如下:

部署开始于 2023-06-16 22:42:15


AppID: wxd86ed6089bd81b35

环境名称:prod-4go88tcy703daed1


[1/2] 执行流水线    进行中 预计需要 2 分钟... -

[2023-06-16 22:42:30] Started by user coding

[2023-06-16 22:42:30] Running in Durability level: MAX_SURVIVABILITY

[2023-06-16 22:42:32] [Pipeline] Start of Pipeline

[2023-06-16 22:42:32] [Pipeline] node

[2023-06-16 22:42:32] Running on Jenkins in /root/workspace

[2023-06-16 22:42:33] [Pipeline] {

[2023-06-16 22:42:33] [Pipeline] stage

[2023-06-16 22:42:33] [Pipeline] { (检出 ZIP 包)

[2023-06-16 22:42:33] Stage "检出 ZIP 包" skipped due to when conditional

[2023-06-16 22:42:33] [Pipeline] }

[2023-06-16 22:42:33] [Pipeline] // stage

[2023-06-16 22:42:33] [Pipeline] stage

[2023-06-16 22:42:33] [Pipeline] { (检出代码仓库)

[2023-06-16 22:42:33] [Pipeline] sh

[2023-06-16 22:42:33] + git clone ****** .

[2023-06-16 22:42:33] Cloning into '.'...

[2023-06-16 22:42:34] [Pipeline] sh

[2023-06-16 22:42:34] + git checkout master

[2023-06-16 22:42:34] Already on 'master'

[2023-06-16 22:42:34] Your branch is up-to-date with 'origin/master'.

[2023-06-16 22:42:34] [Pipeline] }

[2023-06-16 22:42:34] [Pipeline] // stage

[2023-06-16 22:42:34] [Pipeline] stage

[2023-06-16 22:42:34] [Pipeline] { (构建 Docker 镜像)

[2023-06-16 22:42:34] [Pipeline] sh

[2023-06-16 22:42:35] + docker login -u ****** -p ****** ccr.ccs.tencentyun.com/tcb-******-rkwl/ca-ljmqigmn_demo:demo-027-20230616224229

[2023-06-16 22:42:35] WARNING! Using --password via the CLI is insecure. Use --password-stdin.

[2023-06-16 22:42:35] WARNING! Your password will be stored unencrypted in /root/.docker/config.json.

[2023-06-16 22:42:35] Configure a credential helper to remove this warning. See

[2023-06-16 22:42:35] https://docs.docker.com/engine/reference/commandline/login/#credentials-store

[2023-06-16 22:42:35]

[2023-06-16 22:42:35] Login Succeeded

[2023-06-16 22:42:35] [Pipeline] sh

[2023-06-16 22:42:35] + docker build -f ././/Dockerfile -t ccr.ccs.tencentyun.com/tcb-******-rkwl/ca-ljmqigmn_demo:demo-027-20230616224229 ./

[2023-06-16 22:42:35] Sending build context to Docker daemon 78.34kB


[2023-06-16 22:42:35] Step 1/7 : FROM python:3.11

[2023-06-16 22:42:36] 3.11: Pulling from library/python

[2023-06-16 22:42:36] bba7bb10d5ba: Pulling fs layer

[2023-06-16 22:42:36] ec2b820b8e87: Pulling fs layer

[2023-06-16 22:42:36] 284f2345db05: Pulling fs layer

[2023-06-16 22:42:36] fea23129f080: Pulling fs layer

[2023-06-16 22:42:36] 7c62c924b8a6: Pulling fs layer

[2023-06-16 22:42:36] 70c214f8b7b1: Pulling fs layer

[2023-06-16 22:42:36] df30619322b7: Pulling fs layer

[2023-06-16 22:42:36] b5782d5cbcb9: Pulling fs layer

[2023-06-16 22:42:36] df30619322b7: Download complete

[2023-06-16 22:42:37] b5782d5cbcb9: Verifying Checksum

[2023-06-16 22:42:37] b5782d5cbcb9: Download complete

[2023-06-16 22:42:37] 7c62c924b8a6: Verifying Checksum

[2023-06-16 22:42:37] 7c62c924b8a6: Download complete

[2023-06-16 22:42:37] 70c214f8b7b1: Verifying Checksum

[2023-06-16 22:42:37] 70c214f8b7b1: Download complete

[2023-06-16 22:42:37] ec2b820b8e87: Verifying Checksum

[2023-06-16 22:42:37] ec2b820b8e87: Download complete

[2023-06-16 22:42:37] bba7bb10d5ba: Verifying Checksum

[2023-06-16 22:42:37] bba7bb10d5ba: Download complete

[2023-06-16 22:42:37] 284f2345db05: Verifying Checksum

[2023-06-16 22:42:37] 284f2345db05: Download complete

[2023-06-16 22:42:39] bba7bb10d5ba: Pull complete

[2023-06-16 22:42:39] ec2b820b8e87: Pull complete

[2023-06-16 22:42:39] fea23129f080: Verifying Checksum

[2023-06-16 22:42:39] fea23129f080: Download complete

[2023-06-16 22:42:41] 284f2345db05: Pull complete

[2023-06-16 22:42:45] fea23129f080: Pull complete

[2023-06-16 22:42:45] 7c62c924b8a6: Pull complete

[2023-06-16 22:42:46] 70c214f8b7b1: Pull complete

[2023-06-16 22:42:46] df30619322b7: Pull complete

[2023-06-16 22:42:46] b5782d5cbcb9: Pull complete

[2023-06-16 22:42:46] Digest: sha256:2dd2f9000021839e8fba0debd8a2308c7e26f95fdfbc0c728eeb0b5b9a8c6a39

[2023-06-16 22:42:46] Status: Downloaded newer image for python:3.11

[2023-06-16 22:42:46] ---> 09b1cac8826b

[2023-06-16 22:42:46] Step 2/7 : WORKDIR /dim-back

[2023-06-16 22:42:46] ---> Running in dc546608202a

[2023-06-16 22:42:46] Removing intermediate container dc546608202a

[2023-06-16 22:42:46] ---> 206a880055ab

[2023-06-16 22:42:46] Step 3/7 : COPY requirements.txt .

[2023-06-16 22:42:46] ---> 75574b65f566

[2023-06-16 22:42:46] Step 4/7 : RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

[2023-06-16 22:42:47] ---> Running in 8b1484bb5d92

[2023-06-16 22:42:49] Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

[2023-06-16 22:42:49] Collecting fastapi>=0.95.1 (from -r requirements.txt (line 1))

[2023-06-16 22:42:49] Downloading https://pypi.tuna.tsinghua.edu.cn/packages/04/af/1749185fe149662b1f0af3bea74ab0620294752366306cd6098fdb52eafa/fastapi-0.97.0-py3-none-any.whl (56 kB)

[2023-06-16 22:42:49] ERROR: Exception:

[2023-06-16 22:42:49] Traceback (most recent call last):

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 169, in exc_logging_wrapper

[2023-06-16 22:42:49] status = run_func(*args)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 248, in wrapper

[2023-06-16 22:42:49] return func(self, options, args)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 377, in run

[2023-06-16 22:42:49] requirement_set = resolver.resolve(

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve

[2023-06-16 22:42:49] result = self._result = resolver.resolve(

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve

[2023-06-16 22:42:49] state = resolution.resolve(requirements, max_rounds=max_rounds)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 397, in resolve

[2023-06-16 22:42:49] self._add_to_criteria(self.state.criteria, r, parent=None)

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria

[2023-06-16 22:42:49] if not criterion.candidates:

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/resolvelib/structs.py", line 156, in __bool__

[2023-06-16 22:42:49] return bool(self._sequence)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__

[2023-06-16 22:42:49] return any(self)

[2023-06-16 22:42:49] ^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>

[2023-06-16 22:42:49] return (c for c in iterator if id(c) not in self._incompatible_ids)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built

[2023-06-16 22:42:49] candidate = func()

[2023-06-16 22:42:49] ^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link

[2023-06-16 22:42:49] self._link_candidate_cache[link] = LinkCandidate(

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 293, in __init__

[2023-06-16 22:42:49] super().__init__(

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__

[2023-06-16 22:42:49] self.dist = self._prepare()

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare

[2023-06-16 22:42:49] dist = self._prepare_distribution()

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 304, in _prepare_distribution

[2023-06-16 22:42:49] return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 516, in prepare_linked_requirement

[2023-06-16 22:42:49] return self._prepare_linked_requirement(req, parallel_builds)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 587, in _prepare_linked_requirement

[2023-06-16 22:42:49] local_file = unpack_url(

[2023-06-16 22:42:49] ^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 166, in unpack_url

[2023-06-16 22:42:49] file = get_http_url(

[2023-06-16 22:42:49] ^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 107, in get_http_url

[2023-06-16 22:42:49] from_path, content_type = download(link, temp_dir.path)

[2023-06-16 22:42:49] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/network/download.py", line 147, in __call__

[2023-06-16 22:42:49] for chunk in chunks:

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_internal/cli/progress_bars.py", line 52, in _rich_progress_bar

[2023-06-16 22:42:49] with progress:

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/rich/progress.py", line 1169, in __enter__

[2023-06-16 22:42:49] self.start()

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/rich/progress.py", line 1160, in start

[2023-06-16 22:42:49] self.live.start(refresh=True)

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/site-packages/pip/_vendor/rich/live.py", line 132, in start

[2023-06-16 22:42:49] self._refresh_thread.start()

[2023-06-16 22:42:49] File "/usr/local/lib/python3.11/threading.py", line 957, in start

[2023-06-16 22:42:49] _start_new_thread(self._bootstrap, ())

[2023-06-16 22:42:49] RuntimeError: can't start new thread

[2023-06-16 22:42:50] The command '/bin/sh -c pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple' returned a non-zero code: 2

[2023-06-16 22:42:50] [Pipeline] }

[2023-06-16 22:42:50] [Pipeline] // stage

[2023-06-16 22:42:50] [Pipeline] stage

[2023-06-16 22:42:50] [Pipeline] { (推送 Docker 镜像到 TCR)

[2023-06-16 22:42:50] Stage "推送 Docker 镜像到 TCR" skipped due to earlier failure(s)

[2023-06-16 22:42:50] [Pipeline] }

[2023-06-16 22:42:50] [Pipeline] // stage

[2023-06-16 22:42:50] [Pipeline] }

[2023-06-16 22:42:50] [Pipeline] // node

[2023-06-16 22:42:50] [Pipeline] End of Pipeline

[2023-06-16 22:42:50] ERROR: script returned exit code 2

[2023-06-16 22:42:50] Finished: FAILURE

***

-----------构建demo-027-----------

2023-06-16 22:42:30 create_build_image : succ,


Docker file 如下:

# 使用 Python 3.9 基础镜像

FROM python:3.9

# 设置工作目录

WORKDIR /dim-back


# 复制需求文件到工作目录

COPY requirements.txt .


# 安装 Python 依赖

RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple


# 复制应用代码到工作目录

COPY . .


# 暴露应用端口

EXPOSE 80


# 启动 FastAPI 服务器

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]

requirements.txt如下:

fastapi>=0.95.1

mysql-connector-python==8.0.33

mysqlclient==2.1.1

protobuf==3.20.3

pydantic>=1.10.7

SQLAlchemy>=2.0.13

uvicorn==0.22.0

websockets==11.0.3



回答关注问题邀请回答
收藏

1 个回答

  • 外国乐器演奏员
    外国乐器演奏员
    2023-06-21

    老哥解决了么?我也是每次pip install 就can't start new thread,应该是service那边出问题了,但是我尝试在pip install之前ENV MAX_CONCURRENCY=1 这样,但还是不行。

    2023-06-21
    有用
    回复 1
    • Wesin
      Wesin
      2023-06-25
      老哥。解决了吗? 我也遇到了
      2023-06-25
      回复
登录 后发表内容
问题标签