skip to Main Content

This happens with 20.04 & 22.04 docker images with python3.8-minimal and python3.10-minimal (respectively, these are the only ones I’ve tried). Images are being built within VScode.
The problem occurs during

apt install pip

output:

    ente#0 136.4 Preparing to unpack .../libpython3.8-minimal_3.8.10-0ubuntu1~20.04.4_amd64.deb ...

#0 136.4 Unpacking libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.4) ...

#0 136.5 Selecting previously unselected package python3.8-minimal.

#0 136.5 Preparing to unpack .../python3.8-minimal_3.8.10-0ubuntu1~20.04.4_amd64.deb ...

#0 136.5 Unpacking python3.8-minimal (3.8.10-0ubuntu1~20.04.4) ...

#0 136.6 Setting up libpython3.8-minimal:amd64 (3.8.10-0ubuntu1~20.04.4) ...

#0 136.6 Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04.4) ...

#0 136.7 Traceback (most recent call last):

#0 136.7   File "/usr/lib/python3.8/py_compile.py", line 215, in <module>

#0 136.7     sys.exit(main())

#0 136.7   File "/usr/lib/python3.8/py_compile.py", line 207, in main

#0 136.7     compile(filename, doraise=True)

#0 136.7   File "/usr/lib/python3.8/py_compile.py", line 172, in compile

#0 136.7     importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)

#0 136.7   File "<frozen importlib._bootstrap_external>", line 186, in _write_atomic

#0 136.7 PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.8/__pycache__/__future__.cpython-38.pyc.140212054232736'

#0 136.7 dpkg: error processing package python3.8-minimal (--configure):

#0 136.7  installed python3.8-minimal package post-installation script subprocess returned error exit status 1

#0 136.7 Errors were encountered while processing:

#0 136.7  python3.8-minimal

I have tried building a container with nothing in it and running the commands from inside the container.

sudo apt install pip

and

sudo apt install python3-pip

still fail

The output is then:

 erl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
debconf: delaying package configuration, since apt-utils is not installed
Setting up python3.8-minimal (3.8.10-0ubuntu1~20.04.4) ...
Traceback (most recent call last):
  File "/usr/lib/python3.8/py_compile.py", line 215, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/py_compile.py", line 207, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.8/py_compile.py", line 172, in compile
    importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
  File "<frozen importlib._bootstrap_external>", line 186, in _write_atomic
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.8/__pycache__/__future__.cpython-38.pyc.139810610523808'
dpkg: error processing package python3.8-minimal (--configure):
 installed python3.8-minimal package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 python3.8-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

This doesn’t seem to be reproducible on other PCs

failing minimal Dockerfile:

FROM ubuntu:20.04

RUN apt update -y && apt upgrade -y

RUN apt install pip -y

Any help would be greatly appreciated

2

Answers


  1. Chosen as BEST ANSWER

    As suggested in Docker forum, the issue was with the snap installation

        snap uninstall docker
    

    and follow the instructions in Docker documentation.


  2. As mentioned by others, the problem seems to happen when using the overlay2 storage backend in docker. This isn’t limited to the snap, but if you are using the snap then it’s the default configuration. To change this in the snap-installed version of docker:

    • edit /var/snap/docker/current/config/daemon.json and replace
      "overlay2" with "vfs" for the storage-driver
    • run sudo snap restart docker
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search