title: how can I install python-apt in Dockerfile flask
body: <p>I want to use the <code>apt_pkg</code> module in the python file in my container, but when I add the install code, I can't build a Docker file.</p>
  
  <p>First, the original Docker file is  (<em>it is work</em>):</p>
  
  <pre><code>FROM ubuntu:xenial
  RUN apt-get update --fix-missing
  RUN apt-get install -y --fix-missing curl wget zip python-dev python-pip
  RUN apt-get install -y build-essential openssh-client tcpdump
  RUN pip install requests elasticsearch elasticsearch-dsl virtualenv
  RUN cd /opt &amp;&amp; virtualenv flask
  RUN /opt/flask/bin/pip install flask simplejson requests
  
  EXPOSE 8094
  
  ADD . /opt/
  RUN chmod 755 /opt/run.sh
  
  ENTRYPOINT [ "/opt/run.sh" ]
  </code></pre>
  
  <p>Next, I added this line in DockerFile:</p>
  
  <pre><code>RUN /opt/flask/bin/pip install python-apt
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>Step 9/13 : RUN /opt/flask/bin/pip install python-apt
   ---&gt; Running in ed421699d0c0
  Collecting python-apt
    Downloading python-apt-0.7.8.tar.bz2 (49kB)
      Complete output from command python setup.py egg_info:
      Traceback (most recent call last):
        File "&lt;string&gt;", line 1, in &lt;module&gt;
        File "/tmp/pip-build-Mx7WQq/python-apt/setup.py", line 6, in &lt;module&gt;
          from DistUtilsExtra.command import *
      ImportError: No module named DistUtilsExtra.command
  
  ----------------------------------------
  Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-Mx7WQq/python-apt/
  The command '/bin/sh -c /opt/flask/bin/pip install python-apt' returned a non-zero code: 1
  </code></pre>
  
  <p>How can I solve this error?</p>
  
  <p>I can't use RUN <code>apt-get install -y python-apt</code>, because it can't affect the python file.</p>
  
  <blockquote>
    <p>ImportError: No module named apt_pkg</p>
  </blockquote>