system python ?

Coming from Ubuntu and Manjaro Linux, I have the idea that
every Linux distro uses Python scripts as well as Shell scripts,
so we have to be very careful not to mess up the "system python".

Recently I installed FreeBSD 13.1 with only the base system,
and was surprised to see that Python was not installed in it.

My question is: does FreeBSD (the OS itself) ever use Python?

If the answer is no, I can :
  • use pip as root,
  • put my own apps under /usr/local/lib/pythonX/,
  • make a complete broken mess of it,
and the OS will keep on running correctly.

Did I understand that right? Is it true?

Not suggesting it's generally a good idea to stuff up "system python",
just want to know if we can do it, and not crash a FreeBSD system,
in contrast to some Linux distros, where the OS has some essential scripts in Python.
 
first statement is not strictly true as there are linux distributions that have no python integrated into what constitute a distribution. second, FreeBSD is a complete operating system written , i.e tools and kernel is the whole thing, using one language plus maybe certain number of helper scripts in shell ( not counting lua ones like some parts of bootloader ) no need for external third party languages such as python and it's a good thing. you can install python from ports, pkgs or even with pip in isolated environment and it never impacts your base system. all software is isolated. you can mess around with your applications that way
 
When installing FreeBSD one chooses which optional "modules" you want: documentation, sources, ports, etc. Regardless of what one selects, initially there are zero packages; everything in the base system is built from a single source control tree (in fact every module is shipped as a .tgz file and simply extracted on top of the root filesystem). Once installed one can add additional programs either using prebuilt binary packages (using pkg(8) utility, i.e. pkg install bash installs bash with its default configuration picked by the port maintainer), or using ports(7) system, where one can add or strip options before package is compiled and installed. Either approach automatically handles dependencies, but is recommended not to mix both -- either use pre-build packages or ports. Python is not in the base system, therefore it is not installed by default.

That is in contrast with Linux distributions, where base system is typically a collection of 3rd party projects -- kernel, shell, base utilities -- organised as packages, along with their dependencies. Since most Linux distributions pre-install their management utilities (i.e. text user interface package manager like ) that are often Python-based, you get python installed by default, because it is a dependency.

To install python simply do pkg search ^python (pkg will deploy itself on the first run), choose a version and run i.e. pkg install python3. Pre-built modules are with "py<version>" prefix, i.e. pkg search ^py39-.
 
FreeBSD does not have a system python. However, it does provide a system C (and C++) compiler (as per POSIX/SUS) which a few Linux distros lack in their default install. (Interestingly OpenBSD provides a system perl.)

That said, if you use X11 on FreeBSD, bizarrely, that drags in Python and Perl so you might want to consider standardizing on whatever versions they are for a desktop install.
 
Thanks guys for the info.
That's an impressive list from pkg search ^py39-

A month ago I installed gdown via pip, because I didn't imagine that it would be available as a pkg.
(Still had an old idea that FreeBSD is rather out-of-date, but now i know that's far from true.)

A couple of hours ago I installed the gdown package as root.
From now on I'll use that method instead of pip, as much as possible.
I want to install things in the system (not under /home/), so they'll be available to other users.

Neither of you contradicted the idea that I could
"make a complete broken mess of it [/usr/local/lib/pythonX/],
and the OS will keep on running correctly",
so I'll assume that it's true. ;)

At the current stage I'm setting things up and testing (it's not open to other users yet)
so I don't mind if i break Python a bit. There'll be a system backup,
but I don't want to break the system, as I don't want to spend time fixing or restoring it.
 
FreeBSD does not have a system python.
That answers my question.
(I think that if the system doesn't use it, it's not really "system python".)

[Note: my previous reply was written before I saw yours.]

if you use X11
Currently I'm making a simple remote headless server,
but hope to find time to try FreeBSD at home later.
(Getting tired of the frequency and size of Manjaro updates,
and don't like any other Linux distro ... :)
 
Still had an old idea that FreeBSD is rather out-of-date, but now i know that's far from true.
Sssh! This is a closely guarded secret to prevent the uncultured masses coming in. Don't let them know or they will ruin it all! ;)

I don't believe there to really be any gotchas with Python on FreeBSD. If you do need a very old version for whatever reason, Jails running an older userland provide a good solution. I had to do that with Trac a while back.
 
Top