I just watch a Microsoft VDO about using Docker to deploy Flask application on AzureContainerRegistry, I have clone the instructor repo and follow along without any problem
Now I add some additional function to the tutorial application, so the application needs some new dependencies to do the job(e.g. numpy, pandas).
I tried to build Docker image with the command below and get error while installing pandas
How should I fix this issue, I’ve tried using different parent image and still not working.
Build command: docker build --rm -f "Dockerfile" -t zerotoazure.azurecr.io/myeditedapp:latest .
This is content of my Dockerfile
# Pull a pre-built alpine docker image with nginx and python3 installed
# this image is from docker community, its small so our upload to contain will be faster
FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
ENV LISTEN_PORT=8000
EXPOSE 8000
#
COPY /app /app
COPY /calc_logic /calc_logic
# Uncomment to install additional requirements(dependencies) from a requirements.txt file
COPY requirements.txt /
RUN pip install --no-cache-dir -U pip
RUN pip install --no-cache-dir -r /requirements.txt
# from Docker website
#RUN pip install --trusted-host pypi.python.org -r /requirements.txt
This is content in my requirements.txt
astroid==2.2.5
Click==7.0
colorama==0.4.1
Flask==1.0.2
isort==4.3.17
itsdangerous==1.1.0
Jinja2==2.10.1
lazy-object-proxy==1.3.1
MarkupSafe==1.1.1
mccabe==0.6.1
numpy==1.16.2
pandas==0.24.2
pylint==2.3.1
pyodbc==4.0.26
python-dateutil==2.8.0
pytz==2019.1
six==1.12.0
typed-ast==1.3.4
Werkzeug==0.15.2
wrapt==1.11.1
xlrd==1.2.0
This is my error from CMD
terminal
Sending build context to Docker daemon 155.7MB
Step 1/8 : FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
---> df50cc1f4ad6
Step 2/8 : ENV LISTEN_PORT=8000
---> Using cache
---> ae5e4c5e4763
Step 3/8 : EXPOSE 8000
---> Using cache
---> 1477cd20cff4
Step 4/8 : COPY /app /app
---> Using cache
---> c84f46a087b9
Step 5/8 : COPY /calc_logic /calc_logic
---> Using cache
---> 189174ae723b
Step 6/8 : COPY requirements.txt /
---> Using cache
---> 939bbcd76491
Step 7/8 : RUN pip install --no-cache-dir -U pip
---> Using cache
---> 8c637a75ecca
Step 8/8 : RUN pip install --no-cache-dir -r /requirements.txt
---> Running in e5191132b5ea
Collecting astroid==2.2.5 (from -r /requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/d5/ad/7221a62a2dbce5c3b8c57fd18e1052c7331adc19b3f27f1561aa6e620db2/astroid-2.2.5-py3-none-any.whl (193kB)
Requirement already satisfied: Click==7.0 in /usr/local/lib/python3.6/site-packages (from -r /requirements.txt (line 2)) (7.0)
Collecting colorama==0.4.1 (from -r /requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/4f/a6/728666f39bfff1719fc94c481890b2106837da9318031f71a8424b662e12/colorama-0.4.1-py2.py3-none-any.whl
Requirement already satisfied: Flask==1.0.2 in /usr/local/lib/python3.6/site-packages (from -r /requirements.txt (line 4)) (1.0.2)
Collecting isort==4.3.17 (from -r /requirements.txt (line 5))
Downloading https://files.pythonhosted.org/packages/d3/57/2c79076db3c2aa9fc482628b8e70a9f6f2b4cb4b276636645b7080ac26ae/isort-4.3.17-py2.py3-none-any.whl (42kB)
Requirement already satisfied: itsdangerous==1.1.0 in /usr/local/lib/python3.6/site-packages (from -r /requirements.txt (line 6)) (1.1.0)
Collecting Jinja2==2.10.1 (from -r /requirements.txt (line 7))
Downloading https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl (124kB)
Collecting lazy-object-proxy==1.3.1 (from -r /requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/55/08/23c0753599bdec1aec273e322f277c4e875150325f565017f6280549f554/lazy-object-proxy-1.3.1.tar.gz
Collecting MarkupSafe==1.1.1 (from -r /requirements.txt (line 9))
Downloading https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz
Collecting mccabe==0.6.1 (from -r /requirements.txt (line 10))
Downloading https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting numpy==1.16.2 (from -r /requirements.txt (line 11))
Downloading https://files.pythonhosted.org/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip (5.1MB)
Collecting pandas==0.24.2 (from -r /requirements.txt (line 12))
Downloading https://files.pythonhosted.org/packages/b2/4c/b6f966ac91c5670ba4ef0b0b5613b5379e3c7abdfad4e7b89a87d73bae13/pandas-0.24.2.tar.gz (11.8MB)
Complete output from command python setup.py egg_info:
/bin/sh: svnversion: not found
non-existing path in 'numpy/distutils': 'site.cfg'
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 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
don't know how to compile Fortran code on platform 'posix'
Running from numpy source directory.
/tmp/easy_install-wxhh0eto/numpy-1.16.2/setup.py:390: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/system_info.py:638: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/system_info.py:638: 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()
/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/system_info.py:638: 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()
/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/system_info.py:638: 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.
self.calc_info()
/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/system_info.py:638: 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.
self.calc_info()
/usr/local/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/setup.py", line 415, in <module>
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/setup.py", line 407, in setup_package
cmdclass['cython'] = CythonCommand
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/core.py", line 171, in setup
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 163, in run
self.run_command("egg_info")
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/egg_info.py", line 26, in run
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 148, in run
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 159, in build_sources
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 292, in build_library_sources
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 375, in generate_sources
File "numpy/core/setup.py", line 667, in get_mathlib_info
}
RuntimeError: Broken toolchain: cannot link a simple C program
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-7sv0o750/pandas/setup.py", line 746, in <module>
**setuptools_kwargs)
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 724, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 780, in resolve
replace_conflicting=replace_conflicting
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1063, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1075, in obtain
return installer(requirement)
File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 791, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 679, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 705, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 890, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1158, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/local/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 1144, in run_setup
run_setup(setup_script, args)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 253, in run_setup
raise
File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 166, in save_modules
saved_exc.resume()
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 141, in resume
six.reraise(type, exc, self._tb)
File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/usr/local/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/setup.py", line 415, in <module>
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/setup.py", line 407, in setup_package
cmdclass['cython'] = CythonCommand
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/core.py", line 171, in setup
File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 163, in run
self.run_command("egg_info")
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/egg_info.py", line 26, in run
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 148, in run
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 159, in build_sources
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 292, in build_library_sources
File "/tmp/easy_install-wxhh0eto/numpy-1.16.2/numpy/distutils/command/build_src.py", line 375, in generate_sources
File "numpy/core/setup.py", line 667, in get_mathlib_info
}
RuntimeError: Broken toolchain: cannot link a simple C program
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-7sv0o750/pandas/
The command '/bin/sh -c pip install --no-cache-dir -r /requirements.txt' returned a non-zero code: 1
I am running this command locally on my machine below
System: Windows 10X64
Application, VSCODE, Docker for Windows
Python setup: Miniconda with Python 3.7.1
Original post: https://github.com/tiangolo/uwsgi-nginx-flask-docker/issues/132