1

So I am working on a project using Docker, and I need to install Python.

This was previously working fine when my base container was ubuntu:18.04

The package was insalled like so:

FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no- 
install-recommends \
    python \

...

My project will also include Swift, so I changed the base image like so:

FROM swift:5.1

And now I get the following error when apt-get tries to install python:

Errors were encountered while processing: /var/cache/apt/archives/python2.7-minimal_2.7.17-1~18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

The Dockerfile for swift:5.1 can be found here:

https://github.com/apple/swift-docker/blob/72177227fe1ed2da8e921ba291aeb3ff69591e1a/5.1/ubuntu/18.04/Dockerfile

This is also based on ubuntu:18.04 so I suppose the issue must be caused by something in this dockerfile.

My best guess is that perhaps it is because swift:5.1 also installs libpython2.7

What exactly is this error, and how can I avoid it?

edit: here is the context where the error appears:

Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../python2.7-minimal_2.7.17-1~18.04_amd64.deb ...
new installation of python2.7-minimal; /usr/lib/python2.7/site-packages is a directory
which is expected a symlink to /usr/local/lib/python2.7/dist-packages.
please find the package shipping files in /usr/lib/python2.7/site-packages and
file a bug report to ship these in /usr/lib/python2.7/dist-packages instead
aborting installation of python2.7-minimal
dpkg: error processing archive /var/cache/apt/archives/python2.7-minimal_2.7.17-1~18.04_amd64.deb (--unpack):
 new python2.7-minimal package pre-installation script subprocess returned error exit status 1
Selecting previously unselected package python-minimal.
Preparing to unpack .../python-minimal_2.7.15~rc1-1_amd64.deb ...
Unpacking python-minimal (2.7.15~rc1-1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../python2.7_2.7.17-1~18.04_amd64.deb ...
Unpacking python2.7 (2.7.17-1~18.04) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../libpython-stdlib_2.7.15~rc1-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/python2.7-minimal_2.7.17-1~18.04_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sak
  • 2,612
  • 24
  • 55
  • 1
    The lines just before the `dpkg` error would be important. – tripleee Jan 02 '20 at 16:27
  • @tripleee I have added the other lines related to the python install to the body of the question – sak Jan 02 '20 at 17:15
  • Apparent cross-site duplicate: https://askubuntu.com/questions/968139/python2-7-minimal-error-on-xenial – tripleee Jan 02 '20 at 17:20
  • In Dockefile of swift they are installing libpython2.7 which is creating two directories under /usr/lib/python2.7 , one is "site-packges" and other is "dist-packages". I am looking more into these directories – Ashwani Jan 02 '20 at 19:55
  • https://stackoverflow.com/questions/9387928/whats-the-difference-between-dist-packages-and-site-packages – Ashwani Jan 02 '20 at 20:01

0 Answers0