takara9/codes_for_lessons

step10のエラーについて

Opened this issue · 3 comments

起きたエラーとその解決についてです。

step10/job_w_msg_broker/job-initiatorのDockerfileで

❯ docker build --tag job-init:0.1 .                                             
Sending build context to Docker daemon  5.632kB
Step 1/8 : FROM ubuntu:16.04
 ---> fab5e942c505
Step 2/8 : RUN apt-get update && apt-get install -y iputils-ping dnsutils curl apt-transport-https
 ---> Using cache
 ---> 0b58283dca4a
Step 3/8 : RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
 ---> Using cache
 ---> 60f518ef63ea
Step 4/8 : RUN touch /etc/apt/sources.list.d/kubernetes.list
 ---> Using cache
 ---> 44b2cf6f7cd7
Step 5/8 : RUN echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
 ---> Using cache
 ---> 8fbf7875b01b
Step 6/8 : RUN apt-get update && apt-get install -y kubectl
 ---> Using cache
 ---> c2104daa4d32
Step 7/8 : RUN apt-get install -y python python-pip
 ---> Using cache
 ---> db0cf6cbd218
Step 8/8 : RUN pip install pika kubernetes
 ---> Running in 41b86f69832c
Collecting pika
  Downloading https://files.pythonhosted.org/packages/a1/ae/8bedf0e9f1c0c5d046db3a7428a4227fe36ec1b8e25607f3c38ac9bf513c/pika-1.1.0-py2.py3-none-any.whl (148kB)
Collecting kubernetes
  Downloading https://files.pythonhosted.org/packages/60/3f/2fef94fb65e8f94d768356e5fb9be222d18027e6167ccc65e2090917a771/kubernetes-11.0.0.tar.gz (724kB)
Collecting certifi>=14.05.14 (from kubernetes)
  Downloading https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl (156kB)
Collecting six>=1.9.0 (from kubernetes)
  Downloading https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting python-dateutil>=2.5.3 (from kubernetes)
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
Collecting setuptools>=21.0.0 (from kubernetes)
  Downloading https://files.pythonhosted.org/packages/2f/8e/38259f4a44944a92068d5ff77230511a4c685604b47a81318f9e5cf2cc24/setuptools-49.2.0.zip (2.2MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "setuptools/__init__.py", line 21, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 1380
        raise SyntaxError(e) from e
                                ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-XNeSDb/setuptools/
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

のエラーが発生しました。

Dockerfileに

RUN pip install --upgrade pip

を追加することで解決できました。

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y iputils-ping dnsutils curl apt-transport-https


# install kubectl
RUN curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN touch /etc/apt/sources.list.d/kubernetes.list 
RUN echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
RUN apt-get update && apt-get install -y kubectl

# pyhon
RUN apt-get install -y python python-pip
RUN pip install --upgrade pip
RUN pip install pika kubernetes

以上のように追加しました。

@Ganariya さん、ありがとうございます!!
プルリク挙げていただければアクセプトしますよ。

@takara9 さま
step10 / job_w_msg_broker / job-initiatorのDockerfileで
2021-09-19時点ですと、上記(13行目) RUN pip install --upgrade pip だとうまくいきませんでした。
具体的には、バージョン指定して
RUN pip install --upgrade pip==20.1.1
としましたら Successfully build となります。ご参考まで。