我正在尝试将我的文档导入到Docker,以便可以在其上运行cron,但我得到一个错误,为什么尝试将我的文件添加到Docker
这是我得到的错误
#16 30.35 Building wheel for numpy (pyproject.toml): finished with status 'error'
#16 30.35 error: subprocess-exited-with-error
#16 30.35
#16 30.35 × Building wheel for numpy (pyproject.toml) did not run successfully.
#16 30.35 │ exit code: 1
#16 30.35 ╰─> [248 lines of output]
#16 30.35 setup.py:63: RuntimeWarning: NumPy 1.21.6 may not yet support Python 3.10.
#16 30.35 warnings.warn(
#16 30.35 Running from numpy source directory.
#16 30.35 Processing numpy/random/_bounded_integers.pxd.in
#16 30.35 Processing numpy/random/_pcg64.pyx
#16 30.35 Processing numpy/random/_philox.pyx
#16 30.35 Processing numpy/random/mtrand.pyx
#16 30.35 Processing numpy/random/_generator.pyx
#16 30.35 Processing numpy/random/_common.pyx
#16 30.35 Processing numpy/random/_mt19937.pyx
#16 30.35 Processing numpy/random/_sfc64.pyx
#16 30.35 Processing numpy/random/_bounded_integers.pyx.in
#16 30.35 Processing numpy/random/bit_generator.pyx
#16 30.35 Cythonizing sources
#16 30.35 blas_opt_info:
#16 30.35 blas_mkl_info:
#16 30.35 customize UnixCCompiler
#16 30.35 libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 blis_info:
#16 30.35 libraries blis not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 openblas_info:
#16 30.35 libraries openblas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 accelerate_info:
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_3_10_blas_threads_info:
#16 30.35 Setting PTATLAS=ATLAS
#16 30.35 libraries tatlas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_3_10_blas_info:
#16 30.35 libraries satlas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_blas_threads_info:
#16 30.35 Setting PTATLAS=ATLAS
#16 30.35 libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_blas_info:
#16 30.35 libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 /tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/system_info.py:2026: UserWarning:
#16 30.35 Optimized (vendor) Blas libraries are not found.
#16 30.35 Falls back to netlib Blas library which has worse performance.
#16 30.35 A better performance should be easily gained by switching
#16 30.35 Blas library.
#16 30.35 if self._calc_info(blas):
#16 30.35 blas_info:
#16 30.35 libraries blas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 /tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/system_info.py:2026: UserWarning:
#16 30.35 Blas (http://www.netlib.org/blas/) libraries not found.
#16 30.35 Directories to search for the libraries can be specified in the
#16 30.35 numpy/distutils/site.cfg file (section [blas]) or by setting
#16 30.35 the BLAS environment variable.
#16 30.35 if self._calc_info(blas):
#16 30.35 blas_src_info:
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 /tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/system_info.py:2026: UserWarning:
#16 30.35 Blas (http://www.netlib.org/blas/) sources not found.
#16 30.35 Directories to search for the sources can be specified in the
#16 30.35 numpy/distutils/site.cfg file (section [blas_src]) or by setting
#16 30.35 the BLAS_SRC environment variable.
#16 30.35 if self._calc_info(blas):
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 non-existing path in 'numpy/distutils': 'site.cfg'
#16 30.35 lapack_opt_info:
#16 30.35 lapack_mkl_info:
#16 30.35 libraries mkl_rt not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 openblas_lapack_info:
#16 30.35 libraries openblas not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 openblas_clapack_info:
#16 30.35 libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 flame_info:
#16 30.35 libraries flame not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_3_10_threads_info:
#16 30.35 Setting PTATLAS=ATLAS
#16 30.35 libraries lapack_atlas not found in /usr/local/lib
#16 30.35 libraries tatlas,tatlas not found in /usr/local/lib
#16 30.35 libraries lapack_atlas not found in /usr/lib
#16 30.35 libraries tatlas,tatlas not found in /usr/lib
#16 30.35 <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_3_10_info:
#16 30.35 libraries lapack_atlas not found in /usr/local/lib
#16 30.35 libraries satlas,satlas not found in /usr/local/lib
#16 30.35 libraries lapack_atlas not found in /usr/lib
#16 30.35 libraries satlas,satlas not found in /usr/lib
#16 30.35 <class 'numpy.distutils.system_info.atlas_3_10_info'>
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_threads_info:
#16 30.35 Setting PTATLAS=ATLAS
#16 30.35 libraries lapack_atlas not found in /usr/local/lib
#16 30.35 libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
#16 30.35 libraries lapack_atlas not found in /usr/lib
#16 30.35 libraries ptf77blas,ptcblas,atlas not found in /usr/lib
#16 30.35 <class 'numpy.distutils.system_info.atlas_threads_info'>
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 atlas_info:
#16 30.35 libraries lapack_atlas not found in /usr/local/lib
#16 30.35 libraries f77blas,cblas,atlas not found in /usr/local/lib
#16 30.35 libraries lapack_atlas not found in /usr/lib
#16 30.35 libraries f77blas,cblas,atlas not found in /usr/lib
#16 30.35 <class 'numpy.distutils.system_info.atlas_info'>
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 lapack_info:
#16 30.35 libraries lapack not found in ['/usr/local/lib', '/usr/lib']
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 /tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/system_info.py:1858: UserWarning:
#16 30.35 Lapack (http://www.netlib.org/lapack/) libraries not found.
#16 30.35 Directories to search for the libraries can be specified in the
#16 30.35 numpy/distutils/site.cfg file (section [lapack]) or by setting
#16 30.35 the LAPACK environment variable.
#16 30.35 return getattr(self, '_calc_info_{}'.format(name))()
#16 30.35 lapack_src_info:
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 /tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/system_info.py:1858: UserWarning:
#16 30.35 Lapack (http://www.netlib.org/lapack/) sources not found.
#16 30.35 Directories to search for the sources can be specified in the
#16 30.35 numpy/distutils/site.cfg file (section [lapack_src]) or by setting
#16 30.35 the LAPACK_SRC environment variable.
#16 30.35 return getattr(self, '_calc_info_{}'.format(name))()
#16 30.35 NOT AVAILABLE
#16 30.35
#16 30.35 numpy_linalg_lapack_lite:
#16 30.35 FOUND:
#16 30.35 language = c
#16 30.35 define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]
#16 30.35
#16 30.35 Warning: attempted relative import with no known parent package
#16 30.35 /tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'define_macros'
#16 30.35 warnings.warn(msg)
#16 30.35 running bdist_wheel
#16 30.35 running build
#16 30.35 running config_cc
#16 30.35 unifing config_cc, config, build_clib, build_ext, build commands --compiler options
#16 30.35 running config_fc
#16 30.35 unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
#16 30.35 running build_src
#16 30.35 build_src
#16 30.35 building py_modules sources
#16 30.35 creating build
#16 30.35 creating build/src.linux-x86_64-3.10
#16 30.35 creating build/src.linux-x86_64-3.10/numpy
#16 30.35 creating build/src.linux-x86_64-3.10/numpy/distutils
#16 30.35 building library "npymath" sources
#16 30.35 Could not locate executable gfortran
#16 30.35 Could not locate executable f95
#16 30.35 Could not locate executable ifort
#16 30.35 Could not locate executable ifc
#16 30.35 Could not locate executable lf95
#16 30.35 Could not locate executable pgfortran
#16 30.35 Could not locate executable nvfortran
#16 30.35 Could not locate executable f90
#16 30.35 Could not locate executable f77
#16 30.35 Could not locate executable fort
#16 30.35 Could not locate executable efort
#16 30.35 Could not locate executable efc
#16 30.35 Could not locate executable g77
#16 30.35 Could not locate executable g95
#16 30.35 Could not locate executable pathf95
#16 30.35 Could not locate executable nagfor
#16 30.35 Could not locate executable frt
#16 30.35 don't know how to compile Fortran code on platform 'posix'
#16 30.35
#16 30.35
#16 30.35 [Errno 2] No such file or directory: 'gcc'
#16 30.35
#16 30.35
#16 30.35 Traceback (most recent call last):
#16 30.35 File "/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
#16 30.35 main()
#16 30.35 File "/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
#16 30.35 json_out['return_val'] = hook(**hook_input['kwargs'])
#16 30.35 File "/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 249, in build_wheel
#16 30.35 return _build_backend().build_wheel(wheel_directory, config_settings,
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 230, in build_wheel
#16 30.35 return self._build_with_temp_dir(['bdist_wheel'], '.whl',
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
#16 30.35 self.run_setup()
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 267, in run_setup
#16 30.35 super(_BuildMetaLegacyBackend,
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 158, in run_setup
#16 30.35 exec(compile(code, __file__, 'exec'), locals())
#16 30.35 File "setup.py", line 448, in <module>
#16 30.35 setup_package()
#16 30.35 File "setup.py", line 440, in setup_package
#16 30.35 setup(**metadata)
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/core.py", line 169, in setup
#16 30.35 return old_setup(**new_attr)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
#16 30.35 return distutils.core.setup(**attrs)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
#16 30.35 dist.run_commands()
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
#16 30.35 self.run_command(cmd)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
#16 30.35 cmd_obj.run()
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
#16 30.35 self.run_command('build')
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
#16 30.35 self.distribution.run_command(command)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
#16 30.35 cmd_obj.run()
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/command/build.py", line 61, in run
#16 30.35 old_build.run(self)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
#16 30.35 self.run_command(cmd_name)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
#16 30.35 self.distribution.run_command(command)
#16 30.35 File "/tmp/pip-build-env-bziue5yq/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
#16 30.35 cmd_obj.run()
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/command/build_src.py", line 144, in run
#16 30.35 self.build_sources()
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/command/build_src.py", line 155, in build_sources
#16 30.35 self.build_library_sources(*libname_info)
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/command/build_src.py", line 288, in build_library_sources
#16 30.35 sources = self.generate_sources(sources, (lib_name, build_info))
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/distutils/command/build_src.py", line 378, in generate_sources
#16 30.35 source = func(extension, build_dir)
#16 30.35 File "/tmp/pip-install-dw6_ipyp/numpy_0efba7cb95b04a4aac4b6de74e664aeb/numpy/core/setup.py", line 666, in get_mathlib_info
#16 30.35 raise RuntimeError("Broken toolchain: cannot link a simple C program")
#16 30.35 RuntimeError: Broken toolchain: cannot link a simple C program
#16 30.35 [end of output]
#16 30.35
#16 30.35 note: This error originates from a subprocess, and is likely not a problem with pip.
#16 30.35 ERROR: Failed building wheel for numpy
#16 30.35 Failed to build numpy
#16 30.35 ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
#16 30.35 [end of output]
#16 30.35
#16 30.35 note: This error originates from a subprocess, and is likely not a problem with pip.
#16 30.35 error: subprocess-exited-with-error
#16 30.35
#16 30.35 × pip subprocess to install build dependencies did not run successfully.
#16 30.35 │ exit code: 1
#16 30.35 ╰─> See above for output.
#16 30.35
#16 30.35 note: This error originates from a subprocess, and is likely not a problem with pip.
------
executor failed running [/bin/sh -c pip3 install --no-cache-dir --upgrade -r requirements.txt]: exit code: 1
这是我的Dockerfile
FROM alpine:latest
RUN apk add --no-cache python3-dev
RUN apk update
RUN apk add py-pip
RUN apk add py3-wheel
RUN apk add py3-pymysql
RUN apk add mariadb-connector-c
RUN apk add mysql
RUN apk add mariadb-dev
#
WORKDIR /app
#
COPY ./requirements.txt requirements.txt
#
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
#
COPY . /app
#
EXPOSE 8081
#
ENTRYPOINT ["python3"]
#
CMD ["api/main.py", "app.main:app", "--host", "0.0.0.0", "--port", "8081"]
这是我的requirements.txt,它在requests==2.28.1
处出错,如果我从requirements.txt中删除它,在进入docker之前一切都正常,然后它说好像请求丢失了
python-dateutil==2.8.2
xmltodict==0.13.0
fastapi==0.88.0
pydantic>=1.8.0,<2.0.0
uvicorn==0.20.0
requests==2.28.1
#these files give me the error
mariadb==1.1.5.post3
tqdm==4.64.1
numpy==1.23.5
scipy==1.9.3
1条答案
按热度按时间deyfvvtc1#
pip试图从源代码编译numpy,因为a)python的wheel包不可用,或者b)架构和python版本的组合与pypi中预构建的二进制文件不匹配--并且因为您的基础映像没有愚者或依赖项--您的构建失败。
将
--prefer-binary
添加到pip调用 * 可能 * 会有所帮助:但最简单的解决方法是使用一些用于python部署的基础映像。