karina1022 / CV-bot

2 stars 1 forks source link

將專題整合至 docker image 中 #7

Closed yillkid closed 3 years ago

yillkid commented 3 years ago
yillkid commented 3 years ago

在編譯 docker image 時,錯誤訊息如下:

$ sudo docker build . -t cv-bot
Sending build context to Docker daemon  1.394MB
Step 1/5 : FROM python:3.6.9
 ---> 8da0942827f2
Step 2/5 : WORKDIR /app
 ---> Using cache
 ---> a407c0d9f360
Step 3/5 : ADD . /app
 ---> Using cache
 ---> d5c897186e28
Step 4/5 : RUN pip3 install -r requirements.txt
 ---> Running in a58109d87b6b
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/bb/08/9dbc183a3ac6baa95fabf749ddb531bd26256edfff5b6c2195eca26258e9/opencv-python-4.5.1.48.tar.gz (88.3MB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...

  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-g0kr7h_k/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.6'"'"' and sys_platform == '"'"'linux'"'"' and platform_machine == '"'"'aarch64'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"' and platform_machine != '"'"'aarch64'"'"''
       cwd: None
  Complete output (72 lines):
  Ignoring numpy: markers 'python_version >= "3.6" and sys_platform == "linux" and platform_machine == "aarch64"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64"' don't match your environment
  Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarch64"' don't match your environment
  Ignoring numpy: markers 'python_version >= "3.9" and platform_machine != "aarch64"' don't match your environment
  Collecting setuptools
    Downloading https://files.pythonhosted.org/packages/ae/4d/153a2cfab2ea03d4f4aee45d9badb52426db9e2275edfb4b825c5dc55a10/setuptools-54.1.0-py3-none-any.whl (784kB)
  Collecting wheel
    Downloading https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
  Collecting scikit-build
    Downloading https://files.pythonhosted.org/packages/78/c9/7c2c7397ea64e36ebb292446896edcdecbb8c1aa6b9a1a32f6f67984c3df/scikit_build-0.11.1-py2.py3-none-any.whl (72kB)
  Collecting cmake
    Downloading https://files.pythonhosted.org/packages/26/76/b6df98a03343160a27c449c2866d8b94d349be4a3a6632aaf49c8d27916b/cmake-3.18.4.post1.tar.gz
    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: finished with status 'done'
  Collecting pip
    Downloading https://files.pythonhosted.org/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
  Collecting numpy==1.13.3
    Downloading https://files.pythonhosted.org/packages/bf/2d/005e45738ab07a26e621c9c12dc97381f372e06678adf7dc3356a69b5960/numpy-1.13.3.zip (5.0MB)
  Collecting packaging
    Using cached https://files.pythonhosted.org/packages/3e/89/7ea760b4daa42653ece2380531c90f64788d979110a2ab51049d92f408af/packaging-20.9-py2.py3-none-any.whl
  Collecting distro
    Using cached https://files.pythonhosted.org/packages/25/b7/b3c4270a11414cb22c6352ebc7a83aaa3712043be29daa05018fd5a5c956/distro-1.5.0-py2.py3-none-any.whl
  Collecting pyparsing>=2.0.2
    Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
  Building wheels for collected packages: cmake
    Building wheel for cmake (PEP 517): started
    Building wheel for cmake (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmplusix7fo
         cwd: /tmp/pip-install-o5hh84il/cmake
    Complete output (17 lines):
    /tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/setuptools/dist.py:636: UserWarning: Usage of dash-separated 'max-line-length' will not be supported in future versions. Please use the underscore name 'max_line_length' instead
      % (opt, underscore_opt))
    /tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/setuptools/dist.py:636: UserWarning: Usage of dash-separated 'show-pep8' will not be supported in future versions. Please use the underscore name 'show_pep8' instead
      % (opt, underscore_opt))
    /tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/setuptools/dist.py:636: UserWarning: Usage of dash-separated 'show-source' will not be supported in future versions. Please use the underscore name 'show_source' instead
      % (opt, underscore_opt))
    /tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/setuptools/dist.py:636: UserWarning: Usage of dash-separated 'max-complexity' will not be supported in future versions. Please use the underscore name 'max_complexity' instead
      % (opt, underscore_opt))
      File "/tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
        cmkr = cmaker.CMaker(cmake_executable)
      File "/tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
        self.cmake_version = get_cmake_version(self.cmake_executable)
      File "/tmp/pip-build-env-4y3j2gvr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
        "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
    Traceback (most recent call last):

    Problem with the CMake installation, aborting build. CMake executable is cmake
    ----------------------------------------
    ERROR: Failed building wheel for cmake
    Running setup.py clean for cmake
  Failed to build cmake
  Building wheels for collected packages: numpy
    Building wheel for numpy (setup.py): started
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): still running...
    Building wheel for numpy (setup.py): finished with status 'done'
    Created wheel for numpy: filename=numpy-1.13.3-cp36-cp36m-linux_armv7l.whl size=10638280 sha256=2f25aca14fc0991a3178b7fc824bc78e2f196bb8443d7c00301970b8841e514f
    Stored in directory: /root/.cache/pip/wheels/b6/10/65/189b772e73b4505109d5a1e6671b07e65797023718777295e0
  Successfully built numpysudo docker build . -t cv-bot
  ERROR: Could not build wheels for cmake which use PEP 517 and cannot be installed directly
  WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-g0kr7h_k/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.6'"'"' and sys_platform == '"'"'linux'"'"' and platform_machine == '"'"'aarch64'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_machine != '"'"'aarch64'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"' and platform_machine != '"'"'aarch64'"'"'' Check the logs for full command output.
WARNING: You are using pip version 19.3.1; however, version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c pip3 install -r requirements.txt' returned a non-zero code: 1
yillkid commented 3 years ago

Dockerfile

FROM python:3.6.9

WORKDIR /app

ADD . /app

RUN apt-get update && apt-get install -y python3-opencv
RUN pip3 install -r requirements.txt

RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get update
RUN apt-get install -y python3-tflite-runtime

CMD python3 TM2_tflite.py

requirements.txt

line-bot-sdk
yillkid commented 3 years ago

我這邊修正了一個可以動的版本,我們可以一邊討論,一邊整合到你這邊來。

karina1022 commented 3 years ago

已經整合完畢。