首页 > 解决方案 > 相同的 dockerfile 构建在两台不同的机器上。一个正确构建并运行,另一个使用 pip 安装 python 包时出错

问题描述

我无法在我的机器上构建 docker 文件,但它可以在另一台机器上正确构建。

这是 Docker 文件:

来自张量流/张量流:2.3.0-gpu-jupyter

RUN apt-get update && \ 
apt-get install -y ffmpeg && \ 
pip install pyroomacoustics

在一台机器上,它可以正确构建,没有错误,但在我的电脑上,我在 pip 安装 pyroomacoustics 时遇到错误。我也在我的 macbook 上试过这个,但同样的错误失败了。另外两个人在他们的机器上为我运行它,它对他们很好。我很困惑为什么会发生这种情况。

这是错误:

from pyroomacoustics) (1.18.5)
Building wheels for collected packages: pyroomacoustics
  Building wheel for pyroomacoustics (PEP 517): started
  Building wheel for pyroomacoustics (PEP 517): still running...
  Building wheel for pyroomacoustics (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmprd5bmv1v
       cwd: /tmp/pip-install-m7cvkov3/pyroomacoustics
  Complete output (119 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.6
  creating build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/recognition.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/utilities.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/windows.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/metrics.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/version.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/soundsource.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/beamforming.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/multirate.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/room.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/parameters.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/sync.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  copying pyroomacoustics/acoustics.py -> build/lib.linux-x86_64-3.6/pyroomacoustics
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/grid.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/frida.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/doa.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/waves.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/srp.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/utils.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/tops.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/detect_peaks.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/music.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/tools_fri_doa_plane.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/plotters.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  copying pyroomacoustics/doa/cssm.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/doa
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/util.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/rls.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/adaptive_filter.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/subband_lms.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/data_structures.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  copying pyroomacoustics/adaptive/lms.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/adaptive
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/transform
  copying pyroomacoustics/transform/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/transform
  copying pyroomacoustics/transform/stft.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/transform
  copying pyroomacoustics/transform/dft.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/transform
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/delay_calibration.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/physics.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/deconvolution.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/measure_ir.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/localization.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/point_cloud.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/rt60.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  copying pyroomacoustics/experimental/signals.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/experimental
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/utils.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/cmu_arctic.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/timit.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/base.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  copying pyroomacoustics/datasets/google_speech_commands.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/datasets
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/ilrma.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/auxiva.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/trinicon.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/fastmnmf.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/sparseauxiva.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  copying pyroomacoustics/bss/common.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/bss
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/denoise
  copying pyroomacoustics/denoise/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/denoise
  copying pyroomacoustics/denoise/spectral_subtraction.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/denoise
  copying pyroomacoustics/denoise/subspace.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/denoise
  copying pyroomacoustics/denoise/iterative_wiener.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/denoise
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/phase
  copying pyroomacoustics/phase/__init__.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/phase
  copying pyroomacoustics/phase/gl.py -> build/lib.linux-x86_64-3.6/pyroomacoustics/phase
  copying pyroomacoustics/build_rir.pyx -> build/lib.linux-x86_64-3.6/pyroomacoustics
  creating build/lib.linux-x86_64-3.6/pyroomacoustics/data
  copying pyroomacoustics/data/materials.json -> build/lib.linux-x86_64-3.6/pyroomacoustics/data
  running build_ext
  creating tmp
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmpob74w7b2.cpp -o tmp/tmpob74w7b2.o -std=c++14
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmphu4obqnd.cpp -o tmp/tmphu4obqnd.o -fvisibility=hidden
  cythoning pyroomacoustics/build_rir.pyx to pyroomacoustics/build_rir.c
  building 'pyroomacoustics.libroom' extension
  creating build/temp.linux-x86_64-3.6
  creating build/temp.linux-x86_64-3.6/pyroomacoustics
  creating build/temp.linux-x86_64-3.6/pyroomacoustics/libroom_src
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -Ipyroomacoustics/libroom_src -I/tmp/pip-build-env-dghh1s3w/overlay/lib/python3.6/site-packages/pybind11/include -I/tmp/pip-build-env-dghh1s3w/overlay/lib/python3.6/site-packages/pybind11/include -Ipyroomacoustics/libroom_src/ext/eigen -I/usr/include/python3.6m -c pyroomacoustics/libroom_src/libroom.cpp -o build/temp.linux-x86_64-3.6/pyroomacoustics/libroom_src/libroom.o -DEIGEN_MPL2_ONLY -Wall -O3 -DEIGEN_NO_DEBUG -DVERSION_INFO="0.4.1" -std=c++14 -fvisibility=hidden
  In file included from pyroomacoustics/libroom_src/ext/eigen/Eigen/Core:450:0,
                   from /tmp/pip-build-env-dghh1s3w/overlay/lib/python3.6/site-packages/pybind11/include/pybind11/eigen.h:36,
                   from pyroomacoustics/libroom_src/libroom.cpp:30:
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h: In member function ‘std::tuple<Eigen::Matrix<float, D, 1, (AutoAlign | (((((int)D) == 1) && (1 != 1)) ? RowMajor : (((1 == 1) && (((int)D) != 1)) ? ColMajor :  ColMajor))), D, 1>, int, float> Room<D>::next_wall_hit(Vectorf<D>&, Vectorf<D>&, bool) [with long unsigned int D = 2]’:
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h:194:66: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       DenseStorage(const DenseStorage& other) : m_data(other.m_data) {
                                                                    ^
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h:194:66: warning: ‘*((void*)& result +4)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h: In member function ‘std::tuple<Eigen::Matrix<float, D, 1, (AutoAlign | (((((int)D) == 1) && (1 != 1)) ? RowMajor : (((1 == 1) && (((int)D) != 1)) ? ColMajor :  ColMajor))), D, 1>, int, float> Room<D>::next_wall_hit(Vectorf<D>&, Vectorf<D>&, bool) [with long unsigned int D = 3]’:
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h:194:66: warning: ‘result’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       DenseStorage(const DenseStorage& other) : m_data(other.m_data) {
                                                                    ^
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h:194:66: warning: ‘*((void*)& result +4)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  pyroomacoustics/libroom_src/ext/eigen/Eigen/src/Core/DenseStorage.h:194:66: warning: ‘*((void*)& result +8)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  In file included from pyroomacoustics/libroom_src/room.hpp:254:0,
                   from pyroomacoustics/libroom_src/libroom.cpp:38:
  pyroomacoustics/libroom_src/room.cpp: In member function ‘bool Room<D>::is_visible_dfs(Vectorf<D>&, ImageSource<D>&) [with long unsigned int D = 2]’:
  pyroomacoustics/libroom_src/room.cpp:374:18: warning: ‘*((void*)& intersection +4)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         Vectorf<D> intersection;
                    ^~~~~~~~~~~~
  pyroomacoustics/libroom_src/room.cpp:374:18: warning: ‘intersection’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  x86_64-linux-gnu-gcc: internal compiler error: Killed (program cc1plus)
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
  /tmp/pip-build-env-dghh1s3w/overlay/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-m7cvkov3/pyroomacoustics/pyroomacoustics/build_rir.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
  ERROR: Failed building wheel for pyroomacoustics
Failed to build pyroomacoustics
ERROR: Could not build wheels for pyroomacoustics which use PEP 517 and cannot be installed directly

有谁知道为什么会发生这种情况?由于它们是使用相同的 Dockerfile 构建的,因此我假设如果它可以在一台机器上运行,那么它可以在所有其他机器上运行。

标签: pythonlinuxdocker

解决方案


正如 Anthony Sottile 在上述评论中所述,这是一个内存问题。我增加了 docker 设置中的内存限制并且它起作用了。


推荐阅读