-
Notifications
You must be signed in to change notification settings - Fork 967
Description
Before you asking
- I have searched the existing issues
- I spend at least 5 minutes for thinking and preparing
- I checked Frequently Asked Questions (FAQ) in Wiki page
- I am using the latest version of Alas
Describe the bug
podman-compose build failed because it try to build the PyAV from source
And it failed to build the PyAV
My environment:
podman-compose version 1.3.0
podman version 5.4.2
OS: Debian GNU/Linux 13 (trixie) x86_64
Kernel: Linux 6.12.48+deb13-amd64
Alas version:
$ git log --oneline -5
19e580b78 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #5316 from LmeSzinc/dev
51934ff3f (origin/dev) Upd: Effulgence Before Eclipse Rerun (event_20230914_cn) (#5315)
a680c0770 Upd: [tw] PRIVATE_QUARTERS i18n help
df6bc4b69 Upd: [tw] PRIVATE_QUARTERS
1a29d642a Upd: [JP] USE_DATA_KEY_NOTIFIED asset (#5303)
Dockerfile: (I use the Dockerfile, not the Dockerfile.cn)
dockerfile: ./Dockerfile
To Reproduce
- Go to the root folder of the repo.
- Run
podman-compose build --no-cache 2>&1 | tee podmanBuild_1.logCollecting av==10.0.0 Downloading av-10.0.0.tar.gz (2.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 33.0 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [1 lines of output] pkg-config is required for building PyAV [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. - Modify
Dockerfileto install thepkg-configand runpodman-compose build --no-cache 2>&1 | tee podmanBuild_2.logagainCollecting av==10.0.0 Downloading av-10.0.0.tar.gz (2.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 41.4 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [11 lines of output] Package libavformat was not found in the pkg-config search path. Perhaps you should add the directory containing `libavformat.pc' to the PKG_CONFIG_PATH environment variable Package 'libavformat', required by 'virtual:world', not found Package 'libavcodec', required by 'virtual:world', not found Package 'libavdevice', required by 'virtual:world', not found Package 'libavutil', required by 'virtual:world', not found Package 'libavfilter', required by 'virtual:world', not found Package 'libswscale', required by 'virtual:world', not found Package 'libswresample', required by 'virtual:world', not found pkg-config could not find libraries ['avformat', 'avcodec', 'avdevice', 'avutil', 'avfilter', 'swscale', 'swresample'] [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. - Add
FFmpegrequirement and run againpodman-compose build --no-cache 2>&1 | tee podmanBuild_3.logCollecting av==10.0.0 Downloading av-10.0.0.tar.gz (2.4 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 12.9 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [55 lines of output] performance hint: av/logging.pyx:232:5: Exception check on 'log_callback' will always require the GIL to be acquired. Possible solutions: 1. Declare 'log_callback' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions. 2. Use an 'int' return type on 'log_callback' to allow an error code to be returned. Error compiling Cython file: ------------------------------------------------------------ ... cdef const char *log_context_name(void *ptr) nogil: cdef log_context *obj = <log_context*>ptr return obj.name cdef lib.AVClass log_class log_class.item_name = log_context_name ^ ------------------------------------------------------------ av/logging.pyx:216:22: Cannot assign type 'const char *(void *) except? NULL nogil' to 'const char *(*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of 'log_context_name'. Error compiling Cython file: ------------------------------------------------------------ ... # Start the magic! # We allow the user to fully disable the logging system as it will not play # nicely with subinterpreters due to FFmpeg-created threads. if os.environ.get('PYAV_LOGGING') != 'off': lib.av_log_set_callback(log_callback) ^ ------------------------------------------------------------ av/logging.pyx:351:28: Cannot assign type 'void (void *, int, const char *, va_list) except * nogil' to 'av_log_callback' (alias of 'void (*)(void *, int, const char *, va_list) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'log_callback'. Compiling av/logging.pyx because it changed. [1/1] Cythonizing av/logging.pyx Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/usr/local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 488, in run_setup self).run_setup(setup_script=setup_script) File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "<string>", line 172, in <module> File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize cythonize_one(*args) File "/tmp/pip-build-env-gh5vkbn4/overlay/lib/python3.7/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: av/logging.pyx [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
Expected behavior
The image should build success
Relevant log output
The whole Log is huge, so I put that into the google drive
https://drive.google.com/drive/folders/188YOZeWkkcVimKTdnBzfMIwsu5qHJFv_?usp=drive_link
Screenshots
No response
Anything else?
-
Root Cause
I think the root cause is the issue of the
PyAVwhen the docker buildPyAVfrom source
Ref : Pip install is failing to build due to av/logging.pyx error PyAV-Org/PyAV#1140
And this issue should be fixed at thePyAV==11.0.0 -
Solution
I think we can solve this issue in 2 ways
(1) Figure out why we need to build thePyAVfrom source, shouldn't we just install the binary wheels? (maybe EOL at PyAV=10.0.0)
(2) Fix the dependancy ofPyAVFor now,
I try to (2) Fix the dependancy ofPyAV
Ref: How to build PyAV from source (https://pyav.basswood-io.com/docs/stable/overview/installation.html#bring-your-own-ffmpeg)
In short, this is my patch to workaround this issue
# How to apply the patch
1. Save the patch content as the *.patch file
2. Use the 'git am *.patch' to apply it
Important
This patch will update the python from 3.7 to 3.8
It may cause some unexpect issues, please think twice to apply it
Patch content
From 594727ee056411f365639d66bbe3aa2c5a09dbe3 Mon Sep 17 00:00:00 2001
From: CJH-James <[email protected]>
Date: Sat, 15 Nov 2025 08:24:26 +0800
Subject: [PATCH] Fix: Build docker failed because of PyAV
The PyAV==10.0.0 has issue when building it from source
Ref : https://github.com/PyAV-Org/PyAV/issues/1140
And it was fix at the PyAV==11.0.0
Requirement to upgrade PyAV to 11.0.0
1. update the python from 3.7 to 3.8
2. update the numpy from 1.16.6 to 1.19.5
3. update the scipy from 1.4.1 to 1.5.4
Prepare the libary for building PyAV from source
1. build-essential
2. pkg-config
3. libavformat-dev
4. libavcodec-dev
5. libavdevice-dev
6. libavutil-dev
7. libswscale-dev
8. libswresample-dev
---
deploy/docker/Dockerfile | 5 ++++-
deploy/docker/requirements.txt | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile
index cc68a0bb6..febc1c611 100644
--- a/deploy/docker/Dockerfile
+++ b/deploy/docker/Dockerfile
@@ -1,7 +1,7 @@
# docker build -t hgjazhgj/alas:latest .
# docker run -v ${PWD}:/app/AzurLaneAutoScript -p 22267:22267 --name alas -it --rm hgjazhgj/alas
-FROM python:3.7-slim
+FROM python:3.8-slim
WORKDIR /app/AzurLaneAutoScript
@@ -9,7 +9,10 @@ COPY requirements.txt /tmp/requirements.txt
# Initial download of UiAutomator2 is slow outside of China using appetizer mirror, switch to GitHub
RUN apt update \
+ && pip install --upgrade pip setuptools wheel \
&& apt install -y git adb libgomp1 openssh-client \
+ && apt install -y build-essential pkg-config \
+ && apt install -y libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libswresample-dev \
&& git config --global --add safe.directory '*' \
&& pip install -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt \
diff --git a/deploy/docker/requirements.txt b/deploy/docker/requirements.txt
index 06d392fc1..00246dcf8 100644
--- a/deploy/docker/requirements.txt
+++ b/deploy/docker/requirements.txt
@@ -1,6 +1,6 @@
# Image processing
-numpy==1.16.6
-scipy==1.4.1
+numpy==1.19.5
+scipy==1.5.4
pillow
opencv-python-headless
imageio==2.27.0
@@ -12,7 +12,7 @@ uiautomator2cache==0.3.0.1
wrapt==1.13.1
retrying
lz4
-av==10.0.0
+av==11.0.0
psutil==5.9.3
# Utils
--
2.47.3
What's patch done
1. Upgrade the PyAV from 10.0.0 to 11.0.0
2. Add the dependancy for building the PyAV
Requirement to upgrade PyAV to 11.0.0
a. update the python from `3.7` to `3.8`
b. update the numpy from `1.16.6` to `1.19.5`
c. update the scipy from `1.4.1` to `1.5.4`
Prepare the libary for building PyAV from source
a. build-essential
b. pkg-config
c. libavformat-dev
d. libavcodec-dev
e. libavdevice-dev
f. libavutil-dev
g. libswscale-dev
h. libswresample-dev
-
Potential issue
I’m not sure whether upgrading the Python library will affect ALAS’s functionality.
It still take some time to verify.For me
it works well under my PC around a week (from2025/11/07to2025/11/15)