這兩天在測試 Gradio 元件發現時, 將專案程式佈署到 Hugging Face Spaces 都失敗 (之前都沒問題), 例如今天佈署 Video Test 1 時出現如下錯誤訊息 :
===== Build Queued at 2024-12-11 07:03:42 / Commit SHA: 5b17fe2 =====
--> FROM docker.io/library/python:3.10@sha256:3ba2e48b887586835af6a0c35fc6fc6086fb4881e963082330ab0a35f3f42c16
DONE 0.0s
--> RUN apt-get update && apt-get install -y fakeroot && mv /usr/bin/apt-get /usr/bin/.apt-get && echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && chmod +x /usr/bin/apt-get && rm -rf /var/lib/apt/lists/* && useradd -m -u 1000 user
CACHED
--> WORKDIR /home/user/app
CACHED
--> RUN apt-get update && apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install
CACHED
--> COPY --chown=1000:1000 --from=root / /
CACHED
--> RUN pip install --no-cache-dir pip==22.3.1 && pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
CACHED
--> Restoring cache
DONE 9.2s
--> RUN apt-get update && apt-get install -y curl && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs && rm -rf /var/lib/apt/lists/* && apt-get clean
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8789 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [8856 B]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [216 kB]
Fetched 9268 kB in 1s (9977 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.88.1-10+deb12u8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2024-12-11 08:03:59 - Installing pre-requisites
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
ca-certificates is already the newest version (20230311).
curl is already the newest version (7.88.1-10+deb12u8).
gnupg is already the newest version (2.2.40-1.1).
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 25.2 kB of archives.
After this operation, 35.8 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 apt-transport-https all 2.6.1 [25.2 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 25.2 kB in 0s (1350 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29638 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.6.1_all.deb ...
Unpacking apt-transport-https (2.6.1) ...
Setting up apt-transport-https (2.6.1) ...
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Get:4 https://deb.nodesource.com/node_20.x nodistro InRelease [12.1 kB]
Get:5 https://deb.nodesource.com/node_20.x nodistro/main amd64 Packages [9928 B]
Fetched 22.1 kB in 0s (84.3 kB/s)
Reading package lists...
2024-12-11 08:04:01 - Repository configured successfully.
2024-12-11 08:04:01 - To install Node.js, run: apt-get install nodejs -y
2024-12-11 08:04:01 - You can use N|solid Runtime as a node.js alternative
2024-12-11 08:04:01 - To install N|solid Runtime, run: apt-get install nsolid -y
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.8 MB of archives.
After this operation, 197 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_20.x nodistro/main amd64 nodejs amd64 20.18.1-1nodesource1 [31.8 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 31.8 MB in 0s (98.1 MB/s)
Selecting previously unselected package nodejs.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 29642 files and directories currently installed.)
Preparing to unpack .../nodejs_20.18.1-1nodesource1_amd64.deb ...
Unpacking nodejs (20.18.1-1nodesource1) ...
Setting up nodejs (20.18.1-1nodesource1) ...
DONE 7.7s
--> RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt
ERROR: Invalid requirement: 'pip install librosa' (from line 1 of /tmp/requirements.txt)
[notice] A new release of pip available: 22.3.1 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
--> ERROR: process "/bin/sh -c pip install --no-cache-dir -r /tmp/requirements.txt" did not complete successfully: exit code: 1
看起來似乎是 requirement.txt 裡面的 'pip install librosa' 這個指令造成的, 可能是前幾天在測試 Audio 元件時需要用到 librosa 模組, 但剛使用 Hugging Face Space 還不熟悉, 看見有輸入框就輸入 pip insatall 指令, 應該是這樣改到了 requirement.txt (但不解的是, 為何之後每個要佈署的專案的 requirement.txt 裡都有這指令?).
解決此問題需要進去每個佈署失敗的專案的 Files 頁面修改 requirement.txt 這檔案, 首先登入 Hugging Face Space 後進入自己的帳戶 :
可見最近佈署的兩個 Gradio 專案都失敗 (左上角有 'Build Error'), 點專案進去會進入該專案的佈署頁面 (問題還沒解決當然還是失敗), 按頁面右上方的三個點點的小按鈕會出現 App 的設定選單, 按 Files 進入檔案管理頁面 :
點檔案列表中的 requirement.txt 顯示其內容 :
按 Edit 進入檔案編輯頁面 :
將檔案中的 pip install 內容刪除後按最底下的 Commit 鈕更新檔案 :
再次佈署專案就能順利完成了 :
沒有留言 :
張貼留言