When I try to install python or a dependency that requires python in its installation a problem occurs in the installation due to lack of permissions.
Trying to install python inside a container with ubuntu 22
bash console throws following error after trying to install python dependencies
root@c0f46f619a6c:/var/www/html/resources/views/catalogs/pieceworks# apt update && apt install -y python3
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libmpdec3 libpython3-stdlib libpython3.10-minimal libpython3.10-stdlib python3-minimal python3.10 python3.10-minimal
Suggested packages:
python3-doc python3-tk python3-venv python3.10-venv python3.10-doc binutils binfmt-support
The following NEW packages will be installed:
libmpdec3 libpython3-stdlib libpython3.10-minimal libpython3.10-stdlib python3 python3-minimal python3.10 python3.10-minimal
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 5542 kB of archives.
After this operation, 20.6 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-minimal amd64 3.10.6-1~22.04.2ubuntu1 [810 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3.10-minimal amd64 3.10.6-1~22.04.2ubuntu1 [2263 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3-minimal amd64 3.10.6-1~22.04 [24.3 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy/main amd64 libmpdec3 amd64 2.5.1-2build2 [86.8 kB]
Get:5 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-stdlib amd64 3.10.6-1~22.04.2ubuntu1 [1831 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3.10 amd64 3.10.6-1~22.04.2ubuntu1 [497 kB]
Get:7 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3-stdlib amd64 3.10.6-1~22.04 [6910 B]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 python3 amd64 3.10.6-1~22.04 [22.8 kB]
Fetched 5542 kB in 4s (1392 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpython3.10-minimal:amd64.
(Reading database ... 19257 files and directories currently installed.)
Preparing to unpack .../libpython3.10-minimal_3.10.6-1~22.04.2ubuntu1_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.6-1~22.04.2ubuntu1) ...
Selecting previously unselected package python3.10-minimal.
Preparing to unpack .../python3.10-minimal_3.10.6-1~22.04.2ubuntu1_amd64.deb ...
Unpacking python3.10-minimal (3.10.6-1~22.04.2ubuntu1) ...
Setting up libpython3.10-minimal:amd64 (3.10.6-1~22.04.2ubuntu1) ...
Setting up python3.10-minimal (3.10.6-1~22.04.2ubuntu1) ...
[Errno 13] Permission denied: '/usr/lib/python3.10/__pycache__/__future__.cpython-310.pyc.140145098365440'dpkg: error processing package python3.10-mi
nimal (--configure):
installed python3.10-minimal package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
python3.10-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
Do not install docker with snap, I followed the steps given by digital ocean.
I already tried many things including reinstalling docker but I can’t find the solution, does anyone have experience with this type of problem?