如何解决在 Ubuntu 20.04 中构建 docker compose 时在 python numpy 和 pandas 中出错
当我尝试在 python 中构建 docker-compose 文件时遇到了问题。每当我尝试构建 docker 文件时,我都会反复遇到同样的问题。我收到另一个错误,即 docker 发行版不需要 pandas 和 numpy。所以,我从 requirements.txt 中删除了它们,但还是出现了同样的错误。
Building ridesharingservice
Step 1/8 : FROM python:3.8-alpine
---> 39cc898b3c31
Step 2/8 : RUN mkdir /app
---> Using cache
---> 9417f7a1f210
Step 3/8 : WORKDIR /app
---> Using cache
---> 6296aca1df76
Step 4/8 : ADD requirements.txt /app/requirements.txt
---> Using cache
---> f68f8144c248
Step 5/8 : RUN pip3 install -r /app/requirements.txt
---> Using cache
---> c69fc6c2021a
Step 6/8 : ADD . /app
---> Using cache
---> d111d6a78517
Step 7/8 : EXPOSE 8000
---> Using cache
---> 02dcb41e4513
Step 8/8 : CMD ["python3","/app/ridesharing.py"]
---> Using cache
---> 39ea80e6901a
Successfully built 39ea80e6901a
Successfully tagged ridesharestep03_ridesharingservice:latest
Building ratingservice
Step 1/8 : FROM python:3.8-alpine
---> 39cc898b3c31
Step 2/8 : RUN mkdir /app
---> Using cache
---> 9417f7a1f210
Step 3/8 : WORKDIR /app
---> Using cache
---> 6296aca1df76
Step 4/8 : ADD requirements.txt /app/requirements.txt
---> bb9ecaaad729
Step 5/8 : RUN pip3 install -r /app/requirements.txt
---> Running in fdb7b8032d84
Collecting bidict==0.21.2
Downloading bidict-0.21.2-py2.py3-none-any.whl (37 kB)
Collecting click==7.1.2
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting Flask==1.1.2
Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
Collecting flask-mysql-connector==1.1.0
Downloading flask_mysql_connector-1.1.0-py2.py3-none-any.whl (5.8 kB)
Collecting Flask-SocketIO==5.0.1
Downloading Flask_SocketIO-5.0.1-py2.py3-none-any.whl (16 kB)
Collecting itsdangerous==1.1.0
Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Jinja2==2.11.3
Downloading Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Collecting MarkupSafe==1.1.1
Downloading MarkupSafe-1.1.1.tar.gz (19 kB)
Collecting mysql-connector-python==8.0.24
Downloading mysql_connector_python-8.0.24-py2.py3-none-any.whl (319 kB)
Collecting numpy==1.20.2
Downloading numpy-1.20.2.zip (7.8 MB)
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 wheel metadata: started
Preparing wheel metadata: still running...
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python /usr/local/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpsxfkipa8
cwd: /tmp/pip-install-6f2nu5fe/numpy_1e1ffb2c8d0f4670ae933987236dca34
Complete output (226 lines):
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/bit_generator.pyx
Processing numpy/random/_pcg64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_philox.pyx
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_generator.pyx
Processing numpy/random/_common.pyx
Processing numpy/random/_bounded_integers.pyx.in
Cythonizing sources
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
blis_info:
libraries blis not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
openblas_info:
libraries openblas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
atlas_3_10_blas_info:
libraries satlas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,'/usr/lib']
NOT AVAILABLE
blas_info:
libraries blas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
blas_src_info:
NOT AVAILABLE
NOT AVAILABLE
non-existing path in 'numpy/distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
libraries mkl_rt not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
openblas_lapack_info:
libraries openblas not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
openblas_clapack_info:
libraries openblas,lapack not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
flame_info:
libraries flame not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /usr/local/lib
libraries tatlas,tatlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries tatlas,tatlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
libraries lapack_atlas not found in /usr/local/lib
libraries satlas,satlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries satlas,satlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
libraries lapack_atlas not found in /usr/local/lib
libraries ptf77blas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries ptf77blas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
libraries lapack_atlas not found in /usr/local/lib
libraries f77blas,atlas not found in /usr/local/lib
libraries lapack_atlas not found in /usr/lib
libraries f77blas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
libraries lapack not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
lapack_src_info:
NOT AVAILABLE
NOT AVAILABLE
numpy_linalg_lapack_lite:
FOUND:
language = c
define_macros = [('HAVE_BLAS_ILP64',None),('BLAS_SYMBOL_SUFFIX','64_')]
running dist_info
running build_src
build_src
building py_modules sources
creating build
creating build/src.linux-x86_64-3.8
creating build/src.linux-x86_64-3.8/numpy
creating build/src.linux-x86_64-3.8/numpy/distutils
building library "npymath" sources
Could not locate executable gfortran
Could not locate executable f95
Could not locate executable ifort
Could not locate executable ifc
Could not locate executable lf95
Could not locate executable pgfortran
Could not locate executable nvfortran
Could not locate executable f90
Could not locate executable f77
Could not locate executable fort
Could not locate executable efort
Could not locate executable efc
Could not locate executable g77
Could not locate executable g95
Could not locate executable pathf95
Could not locate executable nagfor
Could not locate executable frt
don't know how to compile Fortran code on platform 'posix'
Running from numpy source directory.
setup.py:485: UserWarning: Unrecognized setuptools command,proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
/tmp/pip-install-6f2nu5fe/numpy_1e1ffb2c8d0f4670ae933987236dca34/numpy/distutils/system_info.py:1989: 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.
if self._calc_info(blas):
/tmp/pip-install-6f2nu5fe/numpy_1e1ffb2c8d0f4670ae933987236dca34/numpy/distutils/system_info.py:1989: 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.
if self._calc_info(blas):
/tmp/pip-install-6f2nu5fe/numpy_1e1ffb2c8d0f4670ae933987236dca34/numpy/distutils/system_info.py:1989: UserWarning:
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries tatlas,tatlas not found in /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 /usr/local/lib
customize UnixCCompiler
libraries satlas,satlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries satlas,satlas not found in /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 /usr/local/lib
customize UnixCCompiler
libraries ptf77blas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries ptf77blas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
customize UnixCCompiler
libraries lapack_atlas not found in /usr/local/lib
customize UnixCCompiler
libraries f77blas,atlas not found in /usr/local/lib
customize UnixCCompiler
libraries lapack_atlas not found in /usr/lib
customize UnixCCompiler
libraries f77blas,atlas not found in /usr/lib
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
customize UnixCCompiler
libraries lapack not found in ['/usr/local/lib','/usr/lib']
NOT AVAILABLE
/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/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
/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/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
/usr/local/lib/python3.8/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running install
running build
running config_cc
unifing config_cc,config,build_clib,build_ext,build commands --compiler options
running config_fc
unifing config_fc,build commands --fcompiler options
running build_src
build_src
building py_modules sources
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: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -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/usr/local/include/python3.8 -c'
gcc: _configtest.c
failure.
removing: _configtest.c _configtest.o
Traceback (most recent call last):
File "<string>",line 1,in <module>
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/setup.py",line 443,in <module>
setup_package()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/setup.py",line 435,in setup_package
setup(**metadata)
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/core.py",line 171,in setup
return old_setup(**new_attr)
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py",line 153,in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.8/distutils/core.py",line 148,in setup
dist.run_commands()
File "/usr/local/lib/python3.8/distutils/dist.py",line 966,in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.8/distutils/dist.py",line 985,in run_command
cmd_obj.run()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/install.py",line 62,in run
r = self.setuptools_run()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/install.py",line 36,in setuptools_run
return distutils_install.run(self)
File "/usr/local/lib/python3.8/distutils/command/install.py",line 545,in run
self.run_command('build')
File "/usr/local/lib/python3.8/distutils/cmd.py",line 313,in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.8/distutils/dist.py",in run_command
cmd_obj.run()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/build.py",line 47,in run
old_build.run(self)
File "/usr/local/lib/python3.8/distutils/command/build.py",line 135,in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.8/distutils/cmd.py",in run_command
cmd_obj.run()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/build_src.py",line 142,in run
self.build_sources()
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/build_src.py",in build_sources
self.build_library_sources(*libname_info)
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/numpy/distutils/command/build_src.py",line 286,in build_library_sources
sources = self.generate_sources(sources,(lib_name,build_info))
File "/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/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
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io,os,sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ryihfklw/numpy_edc6962052c8492d98ad701223d36b6d/setup.py'"'"';f = getattr(tokenize,'"'"'open'"'"',open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' install --record /tmp/pip-record-dr7jce4s/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-8rqd46yz/overlay --compile --install-headers /tmp/pip-build-env-8rqd46yz/overlay/include/python3.8/numpy Check the logs for full command output.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/78/e4/a935f1701fac697c6c5458f86968bec5d2b4cb66e7f738225216ebaa20b4/pandas-1.2.2.tar.gz#sha256=14ed84b463e9b84c8ff9308a79b04bf591ae3122a376ee0f62c68a1bd917a773 (from https://pypi.org/simple/pandas/) (requires-python:>=3.7.1). Command errored out with exit status 1: /usr/local/bin/python /tmp/pip-standalone-pip-5wp41dku/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-8rqd46yz/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
Downloading pandas-1.2.1.tar.gz (5.5 MB)
Installing build dependencies: started
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。