Solved How to use pkg set correctly? Packages stuck at py39

Hello,

I noticed that on my machine, which I have just upgraded to 14.2, all python packages seem to be stuck at py39. Yet python 3.11 is installed (as well as python 3.9).

I tried to use "pkg set" to solve this, but without success:
Bash:
for i in $(pkg query -g %n 'py39-*'); do pkg set -yn ${i}:py311-${i#py39-}; done
pkg upgrade
It doesn't update anything... and packages are still at their py39 version.

What am I doing wrong?
 
Read /usr/ports/UPDATING:
Code:
20240529:
  AFFECTS: users of python
  AUTHOR: rm@FreeBSD.org

  The default version of python3 and python was switched to 3.11.

  For ports users wanting to keep version 3.9 as default,
  add DEFAULT_VERSIONS+= python=3.9 python3=3.9 to make.conf

  Following procedures may ease the upgrade:

  For users of pre-build packages:
  # sh
  # for i in $(pkg query -g %n 'py39-*'); do pkg set -yn ${i}:py311-${i#py39-}; done
  # pkg upgrade

  For portmaster users:
  # sh
  # portmaster -o lang/python311 python39
  # REINSTALL="$(pkg info -oq '*py39*')"
  # pkg delete -f "*py39*"
  # portmaster $REINSTALL
  # REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py311 | cut -d : -f 1 | sort -u)
  # portmaster $REBUILD
  # REBUILD2=$(pkg list | grep python-39 | xargs pkg which | awk '{print $6}' | sort -u)
  # portmaster $REBUILD2

  Final steps (for pre-built packages & portmaster):

  If no longer required, Python 3.9 can be removed via
  "pkg remove python39" and the directory /usr/local/lib/python3.9 can
  then be deleted afterwards, if not empty.

You should probably also regularly run pkg-autoremove(8) after upgrading, to remove old dependencies.
 
Thank you, however, the UPDATING file describes exactly what I have done.

I am using pre-built packages, and did exactly as described in UPDATING, the pkg upgrade command keeps telling me "All repositories are up to date." and no packages are upgraded.

Shouldn't it upgrade all the py39 versions to py311?
 
I did run pkg autoremove, it apparently didn't remove anything. I don't know, something is strange.

I now manually installed all the py311 packages I needed (it wasn't many). I suppose now I can get rid of python 3.9?
 
It did remove some now... but not all. Oh well, I'll do a bit of manual intervention. As long as my wsgi scripts don't choke, but I cannot see why they would.

Thanks for your help!
 
So I have three left-overs now... I tried to run 'pkg set' on these individually, and got this result:
Code:
i=py39-lxml
sudo pkg set -n ${i}:py311-${i#py39-}
Change name from py39-lxml to py311-lxml for py39-lxml-4.9.3? [y/N]: y
pkg: sqlite error while executing UPDATE packages SET name='py311-lxml' WHERE id=210 in file pkgdb.c:2504: UNIQUE constraint failed: packages.name
pkg: Package database is busy while closing!
Maybe this is a hint for my dilemma?
 
No, I think you have py311-lxml and py39-lxml installed. It refuses to rename it because it already exists.
 
OK, thanks again. I now simply removed all traces of python 3.9, everything is fine now.

By the way, there is a small issue with the script that UPDATING provides:
The query
Code:
pkg query -g %n 'py39-*'
won't catch ap24-py39-mod_wsgi-4.9.4. So my server did say "Internal server error" for a minute or two... but I doubt anybody noticed ;)
 
Back
Top