Package Management: R vs Python


I'm just starting to code in Python having been an R user for a long time. Am wondering why is it that in Python we need an external package manager (i.e. conda/pip) to install and manage packages but in R we can simply install packages from within R itself?

Would anyone know whether this was intentional decision by the developers of Python or whether there is something unique about the architecture of the R language that facilitates package management from within the language itself?


1 Like

History and tradition. R and Python are roughly the same age and took different paths. R began as a collaborative endeavor from the first, with a central repository of packages, while Python began with Guido's work and later developed into an open source community. RStudio has a commercial package manager. While it's possible to use the fine Anaconda package manager with R, that has resulted in many problem reports here.


[My tentative answer, without firsthand experience, don't take it as definitive truth]

It is at least partly intentional, since it can be technically possible to run pip from within python (but a bad idea). I would also go with a mostly historical aspect.

Installing a package is not trivial, it typically means adding files in various places on the computer, sometimes compiling code, and in many languages it requires administrator permissions. In the 1990s (when R and Python were developed), most of the popular programming languages were compiled, so it made little sense to try and install libraries from within the language.

With that in mind, Python was first developed by a programmer, for programmers, so it makes sense it followed the practices common in programming. R was developed by statisticians, for statisticians, so it did go the extra mile to be user-friendly to non-programmers.

From the point of view of a programmer, it makes sense to separate administrative tasks such as installing external libraries (which modifies the state of the computer) from purely programming aspects. In R too, it is considered bad practice to include install.packages() inside an analysis script. So that possibility in R is really an additional convenience.

Finally, Internet connectivity really grew in the early 1990s making the systematic download of package more obvious (e.g. dpkg and rpm for Linux distributions started in 1993-1994, the CTAN 1992 and CPAN 1993), and Python development started in late 1989, earlier than R (1997, although R was based on S which is much older). So that might also have changed how much thought the authors put into automated download and installation in the early design of the language.