# python babel question



## nedry (May 22, 2021)

Hi I am trying to update my ports and I get the following error message:

```
Installing for py38-Babel-2.9.0
===>  Checking if py38-Babel is already installed
===>   Registering installation for py38-Babel-2.9.0 as automatic
Installing py38-Babel-2.9.0...
pkg-static: py38-Babel-2.9.0 conflicts with py37-Babel-2.9.0 (installs files into the same place).  Problematic file: /usr/local/bin/pybabel
*** Error code 1
```
Is it safe to just uninstall py37-Babel-2.9.0 and install py38-Babel-2.9.0 or will it brake other ports?


----------



## cmoerz (May 22, 2021)

In principle, this should probably work; particularly, since it's the same path. The python package themselves will most certainly not differ whether they are running on python 3.7 or python 3.8. This is just a conflict stemming from the package's flavor.

However, does the attempt of uninstalling devel/py-babel in its' python 3.7 flavor (=py37-Babel) not lead to warnings about other packages getting uninstalled as well? There may be ports that were compiled with python 3.7 as default python version which might get torn out as well.

I haven't had a situation like this before, but I assume this is due to FreeBSD's switch of default version for python. It used to be 3.7, now it's 3.8. You could probably wait until this settles in the binary package repositories or choose your preferred python version and then compile from ports.

You can choose your default python version by updating /etc/make.conf. For example for 3.7:


```
DEFAULT_VERSIONS=python=3.7 python3=3.7
```

Yes, you need to set both - python and python3.


----------



## nedry (May 22, 2021)

I might just wait for an update which results in babel being fully updated to 3.8


----------



## cmoerz (May 22, 2021)

By the way - should have mentioned this before. You can do a `pkg lock` on that package to exclude it from upgrade attempts. You'll need to manually unlock it again at a later point, though.

And a quote from /usr/ports/UPDATING to help with the future upgrade to 3.8:

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


----------



## SirDice (May 24, 2021)

nedry said:


> I am trying to update my ports


Read /usr/ports/UPDATING:

```
20210425:
  AFFECTS: users of python
  AUTHOR: kai@FreeBSD.org

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

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

  Following procedures may ease the upgrade:

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

  For portmaster users:
  # sh
  # portmaster -o lang/python38 python37
  # REINSTALL="$(pkg info -o "*py37*" | awk '{printf "%s ", $2}')"
  # pkg delete -f "*py37*"
  # portmaster $REINSTALL
  # REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py38 | cut -d : -f 1 | sort -u)
  # portmaster $REBUILD
  # REBUILD2=$(pkg list | grep python-37 | xargs pkg which | awk '{print $6}' | sort -u)
  # portmaster $REBUILD2
```


----------

