13

I'm using Docker, and my dockerfile is:

######################################################
FROM ubuntu:20.04

WORKDIR /opt/test

# Apt installs
RUN apt update

######################################################

If I build and run the container, and then run the following, it asks to install python3-minimal, and Python dependencies:

$ docker run -it ubuntu-test
root@3a13a90d3e86:/opt/test# apt install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  alsa-topology-conf alsa-ucm-conf file libasound2 libasound2-data libcanberra0 libexpat1 libgpm2 libltdl7 libmagic-mgc libmagic1 libmpdec2 libogg0 libpython3.8 libpython3.8-minimal libpython3.8-stdlib libreadline8 libsqlite3-0
  libssl1.1 libtdb1 libvorbis0a libvorbisfile3 mime-support readline-common sound-theme-freedesktop vim-common vim-runtime xxd xz-utils
Suggested packages:
  libasound2-plugins alsa-utils libcanberra-gtk0 libcanberra-pulse gpm readline-doc ctags vim-doc vim-scripts
The following NEW packages will be installed:
  alsa-topology-conf alsa-ucm-conf file libasound2 libasound2-data libcanberra0 libexpat1 libgpm2 libltdl7 libmagic-mgc libmagic1 libmpdec2 libogg0 libpython3.8 libpython3.8-minimal libpython3.8-stdlib libreadline8 libsqlite3-0
  libssl1.1 libtdb1 libvorbis0a libvorbisfile3 mime-support readline-common sound-theme-freedesktop vim vim-common vim-runtime xxd xz-utils
0 upgraded, 30 newly installed, 0 to remove and 25 not upgraded.
Need to get 14.9 MB of archives.
After this operation, 70.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] n

These files are in the list: libpython3.8 libpython3.8-minimal libpython3.8-stdlib

Why does Vim require Python?

(This is messing up my Docker image, because I actually need Vim, but I also need 32-bit Python. So I need python3:i386, but Vim is messing it up by installing 64-bit Python too).

5
  • 1
    The developer listed it as required - packages.ubuntu.com/focal/vim
    – guiverc
    Jul 28 at 8:18
  • 9
    @guiverc yes well obviously, but why?
    – user37216
    Jul 28 at 8:23
  • vim allows more features (including extensions) that the developer has added using python which is a common language today. The original vi was written in days where the cost of interpreted languages was too high so only low-level compiled languages made sense (1970s)
    – guiverc
    Jul 28 at 8:34
  • 5
    You may not need vim in the docker image—vim can edit over the network, so you could use that to edit files on the container via your system’s vim. Jul 28 at 18:38
  • 2
    @D.BenKnoble I figured out if I install vim:i386 it'll install the required 32-bit libraries instead and I can have both.
    – user37216
    Jul 29 at 9:09
25

I would guess that the package vim is compiled with support for python. You might have better luck installing the package vim-tiny.

16

This is not new in 20.04. The same is true in 18.04 (with Python 3.6 instead, of course). And in 16.04, once a regression was fixed (LP #1574897). Even back in 12.04, the vim package depended on Python (2.7 at the time). This supports Python scripting inside Vim.

6

The developer listed it as required - https://packages.ubuntu.com/focal/vim

Your option could also be to use vi instead

https://packages.ubuntu.com/focal/nvi

which shows no python3 requirement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.