Pip install opencv-python在安装构建依赖项时卡住

jtoj6r0c  于 2022-11-30  发布在  Python
关注(0)|答案(1)|浏览(2484)

我正在使用最新的pip版本22.3.1,并试图安装opencv-python,但它总是卡在安装构建依赖项后,这个错误出来。
收集opencv-python==4.3.0.38
正在下载opencv-python-4.3.0.38.tar.gz(88.0 MB)

━━━━━━━━━━━━ 88.0/88.0   1.6 MB/s eta 0:00:00

              MB

正在安装生成依赖项...错误
错误:子进程因错误而退出
安装构建依赖项的pip子进程未成功运行。
│退出代码:1
╰─〉[354行输出]

Ignoring numpy: markers 'python_version == "3.5"' don't match your environment

  Ignoring numpy: markers 'python_version == "3.6"' don't match your environment

  Ignoring numpy: markers 'python_version == "3.7"' don't match your environment

  Collecting setuptools

    Using cached setuptools-65.6.3-py3-none-any.whl (1.2 MB)

  Collecting wheel

    Using cached wheel-0.38.4-py3-none-any.whl (36 kB)

  Collecting scikit-build

    Using cached scikit_build-0.16.2-py3-none-any.whl (78 kB)

  Collecting cmake

    Using cached cmake-3.25.0.tar.gz (33 kB)

    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 'done'

    Preparing metadata (pyproject.toml): started

    Preparing metadata (pyproject.toml): finished with status 'done'

  Collecting pip

    Using cached pip-22.3.1-py3-none-any.whl (2.1 MB)

  Collecting numpy==1.17.3

    Downloading numpy-1.17.3.zip (6.4 MB)

       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 3.3 MB/s eta 0:00:00

    Preparing metadata (setup.py): started

    Preparing metadata (setup.py): finished with status 'done'

  Collecting distro

    Using cached distro-1.8.0-py3-none-any.whl (20 kB)

  Collecting packaging

    Using cached packaging-21.3-py3-none-any.whl (40 kB)

  Collecting pyparsing!=3.0.5,>=2.0.2

    Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)

  Building wheels for collected packages: numpy, cmake

    Building wheel for numpy (setup.py): started

    Building wheel for numpy (setup.py): finished with status 'error'

    error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully.

    │ exit code: 1

    ╰─> [247 lines of output]

        Running from numpy source directory.

        blas_opt_info:

        blas_mkl_info:

        customize UnixCCompiler

          libraries mkl_rt not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        blis_info:

        customize UnixCCompiler

          libraries blis not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        openblas_info:

        customize UnixCCompiler

        customize UnixCCompiler

          libraries openblas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        atlas_3_10_blas_threads_info:

        Setting PTATLAS=ATLAS

        customize UnixCCompiler

          libraries tatlas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        atlas_3_10_blas_info:

        customize UnixCCompiler

          libraries satlas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        atlas_blas_threads_info:

        Setting PTATLAS=ATLAS

        customize UnixCCompiler

          libraries ptf77blas,ptcblas,atlas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        atlas_blas_info:

        customize UnixCCompiler

          libraries f77blas,cblas,atlas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        accelerate_info:

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/system_info.py:690: UserWarning:

            Optimized (vendor) Blas libraries are not found.

            Falls back to netlib Blas library which has worse performance.

            A better performance should be easily gained by switching

            Blas library.

          self.calc_info()

        blas_info:

        customize UnixCCompiler

          libraries blas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/system_info.py:690: UserWarning:

            Blas (http://www.netlib.org/blas/) libraries not found.

            Directories to search for the libraries can be specified in the

            numpy/distutils/site.cfg file (section [blas]) or by setting

            the BLAS environment variable.

          self.calc_info()

        blas_src_info:

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/system_info.py:690: UserWarning:

            Blas (http://www.netlib.org/blas/) sources not found.

            Directories to search for the sources can be specified in the

            numpy/distutils/site.cfg file (section [blas_src]) or by setting

            the BLAS_SRC environment variable.

          self.calc_info()

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/bin/sh: 1: svnversion: not found

        non-existing path in 'numpy/distutils': 'site.cfg'

        lapack_opt_info:

        lapack_mkl_info:

        customize UnixCCompiler

          libraries mkl_rt not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        openblas_lapack_info:

        customize UnixCCompiler

        customize UnixCCompiler

          libraries openblas not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        openblas_clapack_info:

        customize UnixCCompiler

        customize UnixCCompiler

          libraries openblas,lapack not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        flame_info:

        customize UnixCCompiler

          libraries flame not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        atlas_3_10_threads_info:

        Setting PTATLAS=ATLAS

        customize UnixCCompiler

          libraries lapack_atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        customize UnixCCompiler

          libraries tatlas,tatlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>

          NOT AVAILABLE

        atlas_3_10_info:

        customize UnixCCompiler

          libraries lapack_atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        customize UnixCCompiler

          libraries satlas,satlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        <class 'numpy.distutils.system_info.atlas_3_10_info'>

          NOT AVAILABLE

        atlas_threads_info:

        Setting PTATLAS=ATLAS

        customize UnixCCompiler

          libraries lapack_atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        customize UnixCCompiler

          libraries ptf77blas,ptcblas,atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        <class 'numpy.distutils.system_info.atlas_threads_info'>

          NOT AVAILABLE

        atlas_info:

        customize UnixCCompiler

          libraries lapack_atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        customize UnixCCompiler

          libraries f77blas,cblas,atlas not found in /data/data/com.learnprogramming.codecamp/files/usr/lib

        <class 'numpy.distutils.system_info.atlas_info'>

          NOT AVAILABLE

        lapack_info:

        customize UnixCCompiler

          libraries lapack not found in ['/data/data/com.learnprogramming.codecamp/files/usr/lib']

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/system_info.py:1712: UserWarning:

            Lapack (http://www.netlib.org/lapack/) libraries not found.

            Directories to search for the libraries can be specified in the

            numpy/distutils/site.cfg file (section [lapack]) or by setting

            the LAPACK environment variable.

          if getattr(self, '_calc_info_{}'.format(lapack))():

        lapack_src_info:

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/system_info.py:1712: UserWarning:

            Lapack (http://www.netlib.org/lapack/) sources not found.

            Directories to search for the sources can be specified in the

            numpy/distutils/site.cfg file (section [lapack_src]) or by setting

            the LAPACK_SRC environment variable.

          if getattr(self, '_calc_info_{}'.format(lapack))():

          NOT AVAILABLE

        /data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'

          warnings.warn(msg)

        running bdist_wheel

        running build

        running config_cc

        unifing config_cc, config, build_clib, build_ext, build commands --compiler options

        running config_fc

        unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options

        running build_src

        build_src

        building py_modules sources

        creating build

        creating build/src.linux-aarch64-3.1

        creating build/src.linux-aarch64-3.1/numpy

        creating build/src.linux-aarch64-3.1/numpy/distutils

        building library "npymath" sources

        get_default_fcompiler: matching types: '['gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor']'

        customize Gnu95FCompiler

        Could not locate executable gfortran

        Could not locate executable f95

        customize IntelFCompiler

        Could not locate executable ifort

        Could not locate executable ifc

        customize LaheyFCompiler

        Could not locate executable lf95

        customize PGroupFCompiler

        Could not locate executable pgfortran

        customize AbsoftFCompiler

        Could not locate executable f90

        Could not locate executable f77

        customize NAGFCompiler

        customize VastFCompiler

        customize CompaqFCompiler

        Could not locate executable fort

        customize IntelItaniumFCompiler

        Could not locate executable efort

        Could not locate executable efc

        customize IntelEM64TFCompiler

        customize GnuFCompiler

        Could not locate executable g77

        customize G95FCompiler

        Could not locate executable g95

        customize PathScaleFCompiler

        Could not locate executable pathf95

        customize NAGFORCompiler

        Could not locate executable nagfor

        don't know how to compile Fortran code on platform 'posix'

        C compiler: aarch64-linux-android-clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC

        compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/data/data/com.learnprogramming.codecamp/files/usr/include/python3.10 -c'

        aarch64-linux-android-clang: _configtest.c

        failure.

        removing: _configtest.c _configtest.o

        Traceback (most recent call last):

          File "<string>", line 2, in <module>

          File "<pip-setuptools-caller>", line 34, in <module>

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/setup.py", line 443, in <module>

            setup_package()

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/setup.py", line 435, in setup_package

            setup(**metadata)

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/core.py", line 171, in setup

            return old_setup(**new_attr)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup

            return distutils.core.setup(**attrs)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/core.py", line 148, in setup

            dist.run_commands()

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands

            self.run_command(cmd)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command

            cmd_obj.run()

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 325, in run

            self.run_command("build")

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command

            self.distribution.run_command(command)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command

            cmd_obj.run()

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/command/build.py", line 47, in run

            old_build.run(self)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/command/build.py", line 135, in run

            self.run_command(cmd_name)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command

            self.distribution.run_command(command)

          File "/data/data/com.learnprogramming.codecamp/files/usr/lib/python3.10/distutils/dist.py", line 985, in run_command

            cmd_obj.run()

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/command/build_src.py", line 142, in run

            self.build_sources()

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/command/build_src.py", line 153, in build_sources

            self.build_library_sources(*libname_info)

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/command/build_src.py", line 286, in build_library_sources

            sources = self.generate_sources(sources, (lib_name, build_info))

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-install-5maxp87n/numpy_a3b75f42d58644aa86df8f2e4a7c1672/numpy/distutils/command/build_src.py", line 369, in generate_sources

            source = func(extension, build_dir)

          File "numpy/core/setup.py", line 669, in get_mathlib_info

            raise RuntimeError("Broken toolchain: cannot link a simple C program")

        RuntimeError: Broken toolchain: cannot link a simple C program

        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.

    ERROR: Failed building wheel for numpy

    Running setup.py clean for numpy

    error: subprocess-exited-with-error

    × python setup.py clean did not run successfully.

    │ exit code: 1

    ╰─> [10 lines of output]

        Running from numpy source directory.

        `setup.py clean` is not supported, use one of the following instead:

          - `git clean -xdf` (cleans all files)

          - `git clean -Xdf` (cleans all versioned files, doesn't touch

                              files that aren't checked into the git repo)

        Add `--force` to your command to use it anyway if you must (unsupported).

        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.

    ERROR: Failed cleaning build dir for numpy

    Building wheel for cmake (pyproject.toml): started

    Building wheel for cmake (pyproject.toml): finished with status 'error'

    error: subprocess-exited-with-error

    × Building wheel for cmake (pyproject.toml) did not run successfully.

    │ exit code: 1

    ╰─> [32 lines of output]

        Traceback (most recent call last):

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-build-env-7nym68sq/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 612, in setup

            cmkr = cmaker.CMaker(cmake_executable)

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-build-env-7nym68sq/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 148, in __init__

            self.cmake_version = get_cmake_version(self.cmake_executable)

          File "/data/data/com.learnprogramming.codecamp/files/usr/tmp/pip-build-env-7nym68sq/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 103, in get_cmake_version

            raise SKBuildError(

            =============================DEBUG ASSISTANCE=============================

            If you are seeing a compilation error please try the following steps to

            successfully install cmake:

            1) Upgrade to the latest pip and try again. This will fix errors for most

               users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip

            2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in

               order to retrieve the last manylinux1 compatible wheel.

            3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your

               requirements in order to retrieve the last manylinux1 compatible wheel.

            4) Open an issue with the debug information that follows at

               https://github.com/scikit-build/cmake-python-distributions/issues

            Python: 3.10.4

            platform: Linux-4.19.127+-aarch64-with-libc

            machine: aarch64

            bits: 64

            pip: n/a

            setuptools: 65.6.3

            scikit-build: 0.16.2

            PEP517_BUILD_BACKEND=setuptools.build_meta

            =============================DEBUG ASSISTANCE=============================

        Problem with the CMake installation, aborting build. CMake executable is cmake

        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.

    ERROR: Failed building wheel for cmake

  Failed to build numpy cmake

  ERROR: Could not build wheels for cmake, which is required to install pyproject.toml-based projects

  [end of output]

注意:此错误源于子进程,可能不是pip的问题。
错误:子进程因错误而退出
安装构建依赖项的pip子进程未成功运行。
│退出代码:1
╰─〉输出见上。
注意:这个错误来源于一个子进程,可能不是pip的问题。
我试着升级pip,重新安装,安装不同版本的opencv,但都不起作用。

kuuvgm7e

kuuvgm7e1#

尝试将numpy添加到requirements.txt中,例如:

numpy==1.23.4

因为这可能是由于缺少open-cv所依赖的numpy安装而导致的。重要:因此,您必须在open-cv之前将其添加到需求中!
如果这样做不起作用,也许可以尝试这里提供的解决方案:安装SciPy时未找到BLAS/LAPACK库

相关问题