Re: Python version dependencies in pkg

From: Stefan Esser <>
Date: Thu, 29 Sep 2022 08:06:37 UTC
Am 29.09.22 um 08:39 schrieb Alexander Leidinger:
> Quoting Rainer Hurling <> (from Thu, 29 Sep 2022 06:43:49 +0200):
>> Hi Dan,
>> Am 28.09.22 um 23:01 schrieb Dan Mahoney:
>>> Okay, so in either the package file, or the repo file, is there a bit that 
>>> says "whatever is the default" or that explicitly says "if there's not a 
>>> python, install 3.8"?
>> There is PYTHON_DEFAULT (set to 3.9 ATM) in ports/Mk/ 
>> You can override this for example by an entry in /etc/make.conf:
>> DEFAULT_VERSIONS+= python=3.10 python3=3.10
>>> I realize I'm asking weird minute questions, but I'm noticing that across 
>>> our fleet we have some blend of machines that are 3.7, 3.8, and 3.9, and 
>>> trying to just remove 3.7 attempts to deinstall packages that would work 
>>> with 3.8.
>> To update from one Python version to another, there are descriptions in 
>> /usr/ports/UPDATING, see entry from 20220626.
>> After changing Python itself (i.e. from 3.7 to 3.9), rebuilding depending 
>> py3x-packages will do this version change for you (i.e. from py3.7-* to 
>> py3.9-*, ...). It works via the so called flavors.
> To extend a little bit on that:
> "pkg info | grep py3" will give you a list of ports which are depending on a 
> specific python version. If it lists py37-xxx it means the xxx port depends 
> upon python 3.7. If you then delete python 3.7 pkg will also ask you if it is 
> ok to delete all the py37-* ports.

There are many ports that depend on some specific Python version without
"py3" in their package names.

The following command lists all installed packages that depend on the
version of the python interpreter in the first column:

	pkg query "%dn %n-%v" | grep -E "^python3[0-9]+ "

Regards, STefan