Score:13

Why does Vim in Ubuntu 20.04 require Python 3?

tv flag

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).

guiverc avatar
cn flag
The developer listed it as required - https://packages.ubuntu.com/focal/vim
user37216 avatar
tv flag
@guiverc yes well obviously, but *why*?
guiverc avatar
cn flag
`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)
D. Ben Knoble avatar
lk flag
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.
user37216 avatar
tv flag
@D.BenKnoble I figured out if I install vim:i386 it'll install the required 32-bit libraries instead and I can have both.
Score:26
jp flag

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

Score:16
us flag

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.

Score:6
cn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.