6

Is the Python standard library standard in the sense that if Python is installed, then the standard library is installed too?

The documentation reads

For Unix-like operating systems Python is normally provided as a collection of packages, so it may be necessary to use the packaging tools provided with the operating system to obtain some or all of the optional components.

The standard library index only lists as optional the "Optional Operating System Services", as far as I can tell.

So, is everything else always available on a platform, if Python is installed? If not, what can be expected on the most common ones (Windows, Mac OS X, Linux)?

PS: I am teaching a Python class to graduate students, and I would love to be able to tell them that Python always comes with batteries included; this is of practical importance, for them (when they arrive in a new lab, or use a new machine, it is useful for them to know what to expect in terms of standard modules availability).

Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
  • Have you checked a few installations to see what you got? What are you teaching on? What have you looked at? – S.Lott Sep 28 '10 at 03:09
  • @S.Lott: I want to let the students know what *they* can expect when they arrive in a new (laboratory) environment and have to use whatever computer they are given. This is useful, practical information, for them. (I did take care of installing everything the students need for the class on the machines they use.) – Eric O. Lebigot Sep 28 '10 at 07:38

3 Answers3

8

It's not a Python issue. You can teach that the batteries are included. They are.

It's the distributions that are incomplete.

We've been unhappy with the Red Hat Enterprise Linux having old versions of Python. However, there are recipes for upgrades.

It's a common security practice to turn off all developer packages, leaving Python incomplete. This is a common situation outside Python and outside the essential Linux distribution.

Batteries are included under normal circumstances. But, it's also very easy to strip some or all of the batteries. And many organizations will -- for a variety of reasons -- create incomplete libraries.

It's not Python. It's the environments that are incomplete.

S.Lott
  • 384,516
  • 81
  • 508
  • 779
  • +1: Good point. I guess that the morale is that you sometimes have to go to the store and get Python batteries; but the good thing is that they always have them in stock. :) – Eric O. Lebigot Sep 28 '10 at 07:34
6

Generally yes -- everything not listed in the optional section will always be available.

These are some of the things that may vary from OS to OS installation: http://docs.python.org/library/someos.html

You probably won't use these unless you're doing fairly advanced programming.

dkamins
  • 21,450
  • 7
  • 55
  • 59
  • 2
    That's not really true on Unix installations. For example, installing the lang/python27 port on FreeBSD will *not* get you the bsddb, gdbm, sqlite3, or tkinter modules. Each of those depend on other packages that aren't installed by default. – Kirk Strauser Sep 28 '10 at 01:37
  • @Just Some Guy - Thanks for adding that. For completeness, is that a comprehensive list of what has external dependencies or just a few examples? – dkamins Sep 28 '10 at 04:16
  • 1
    I think that's comprehensive for FreeBSD - it's based on the message displayed to users after installing Python. Ubuntu also has both "python" and "python-minimal" packages, with "minimal" skipping the same sorts of things that FreeBSD does. I'm not sure which (if either) of those gets installed by default. – Kirk Strauser Sep 28 '10 at 13:33
2

It depends on the distribution packager. For example on Debian the profiling modules profile and cprofile are installed separately as python-profiler. Other modules may be separated like this too on different distributions.

Radomir Dopieralski
  • 2,557
  • 17
  • 14