Python 3.11 Upgrade

Hi all,

We’re currently in the process of developing a tomographic reconstruction extension for 3D slicer (currently SPECT, we hope to build others for PET/CT soon as well). Our extension relies on PyTomography, which itself requires python 3.11; as such, this is a feature request to upgrade the python version of 3D Slicer to 3.11 :slight_smile:

Upgrading the Slicer python version from 3.9 to something newer is something currently being tracked at:

Python 3.11 seems to be a good candidate for the next version that Slicer upgrades to. It will probably happen sometime this year though I don’t believe there is specific funding or plans for volunteered time to support this effort. @jcfr would probably know best.

@lukepolson since you are the primary developer of PyTomography can you describe what Python 3.11 specific features you use in your code that are not supported by Python 3.9? Would you be able to adapt your code to keep your Slicer extension development going if the Slicer python upgrade does not happen soon?

Hi @jamesobutler , sorry for the very late reply: I had thought I already replied here! We did end up changing a few things in PyTomography so that its compatible with python 3.9. Previously I was using features of Python 3.11 to perform array indexing using the unpacking (*) operator, which isn’t available in earlier version of python. Changing the code required adding a few extra lines, but had no effect on any computational speed or anything. This may be something to be aware of when evaluating the importance of upgrading to python 3.11, as some developers of extensions may unknowingly use new features of the language.

1 Like