GitHub Actions安装MoviePy报错:subprocess-exited-with-error
GitHub Actions安装MoviePy时出现
NameError: name 'TestCommand' is not defined问题 本地环境安装MoviePy完全正常,但在GitHub Actions的CI环境中偶尔安装失败。错误表现为「获取构建wheel的需求」步骤执行失败,退出码为1,错误提示显示问题源自子进程,大概率与pip无关,具体错误栈指向NameError: name 'TestCommand' is not defined。已尝试升级pip和setuptools,但问题仍未解决。
完整错误日志
Downloading moviepy-1.0.3.tar.gz (388 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 388.3/388.3 kB 32.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 ╰─> [20 lines of output] Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/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-dismlhz9/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-dismlhz9/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-dismlhz9/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 497, in run_setup super().run_setup(setup_script=setup_script) File "/tmp/pip-build-env-dismlhz9/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 313, in run_setup exec(code, locals()) File "<string>", line 21, in <module> NameError: name 'TestCommand' is not defined [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. note: This error originates from a subprocess, and is likely not a problem with pip. Notice: A new release of pip is available: 24.1.2 -> 24.2 Notice: To update, run: pip install --upgrade pip
GitHub Actions工作流配置
name: Build and deploy Python app to Azure Web App - speaksmart-ai on: push: branches: - main workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python version uses: actions/setup-python@v5 with: python-version: '3.11' - name: Create and start virtual environment run: | python -m venv venv source venv/bin/activate - name: Install dependencies run: pip install -r requirements.txt # Optional: Add step to run tests here (PyTest, Django test suites, etc.) - name: Zip artifact for deployment run: zip release.zip ./* -r - name: Upload artifact for deployment jobs uses: actions/upload-artifact@v4 with: name: python-app path: | release.zip !venv/ ........
内容的提问来源于stack exchange,提问作者dnrksd
相关产品推荐
相关产品推荐

