# Can't get salt-api to detect cherrypy



## sand_man (Sep 15, 2022)

One of the pre-requisites for salt-api to work is installing cherrypy. Currently salt is using python38 while the latest cherrypy package uses python39. I have both installed however when I run salt-api with debug logging I see the following error


```
[ERROR   ] Not loading 'salt.loaded.int.netapi.rest_cherrypy'. Error loading CherryPy: No module named 'cherrypy'
```
The salt-api will then close shortly after.
I've also tried installing cherrypy using pip but that also has not worked.

Any suggestions?


----------



## SirDice (Sep 15, 2022)

sand_man said:


> Currently salt is using python38 while the latest cherrypy package uses python39.


The default Python changed some time ago from Python 3.8 to 3.9. You should fix your 'old' 3.8 packages.


```
20220626:
  AFFECTS: users of python
  AUTHOR: thierry@FreeBSD.org

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

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

  Following procedures may ease the upgrade:

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

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

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

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


----------



## sand_man (Sep 16, 2022)

Thanks SirDice. I figured that's what I needed to do but I swear when I wrote this yesterday there was no py39-salt, only py38. I just checked again and there it is.


----------

