# Extension compatibility with Python 2 and 3

**URL:** <https://discourse.slicer.org/t/extension-compatibility-with-python-2-and-3/13928>\
**Category:** Development\
**Tags:** extensions-manager, python\
**Created:** [October 7, 2020, 8:36pm UTC](https://discourse.slicer.org/t/extension-compatibility-with-python-2-and-3/13928 "2020-10-07T20:36:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehrtash](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/mehrtash/32/165_2.png) [@mehrtash](https://discourse.slicer.org/u/mehrtash)\
**Post date:** [October 7, 2020, 8:36pm UTC](https://discourse.slicer.org/t/extension-compatibility-with-python-2-and-3/13928/1 "2020-10-07T20:36:40Z")

</div>

DeepInfer and probably some other modules do not work in Slicer 4.11 due to python 3 incompatibility. [1]

I have made some changes to the code to make it compatible with python 3 but the problem is that it would not work in the previous Slicer versions including 4.10.

Is there any way to specify a specific git id in the s4ext file for Slicer v \<=4.10 to support backward compatibility and master for v\>=4.11?

[1] [https://github.com/DeepInfer/Slicer-DeepInfer/issues/13](https://github.com/DeepInfer/Slicer-DeepInfer/issues/13)

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [October 7, 2020, 8:47pm UTC](https://discourse.slicer.org/t/extension-compatibility-with-python-2-and-3/13928/2 "2020-10-07T20:47:13Z")

</div>

The factory build machines are no longer building Slicer 4.10 extensions so updates to [https://github.com/Slicer/ExtensionsIndex/tree/4.10](https://github.com/Slicer/ExtensionsIndex/tree/4.10) won’t result in any changes. The current stable is the Slicer 4.11.20200930 snapshot. Updates for this new stable for the factory to build would be made to the s4ext in [https://github.com/Slicer/ExtensionsIndex/tree/4.11](https://github.com/Slicer/ExtensionsIndex/tree/4.11).

If you want to support building the extension on your own for compatibility with Slicer 4.10 you can update your code checking slicer version such as `slicer.app.majorVersion`, `slicer.app.minorVersion`, and `slicer.app.patchVersion`.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 7, 2020, 9:07pm UTC](https://discourse.slicer.org/t/extension-compatibility-with-python-2-and-3/13928/3 "2020-10-07T21:07:59Z")

</div>

If you don’t want to pollute your code with version checks then:

- in your repository create a new `4.10` branch from current master
- send a pull request to [https://github.com/Slicer/ExtensionsIndex/tree/4.10](https://github.com/Slicer/ExtensionsIndex/tree/4.10) to use `4.10` branch of your extension instead of master (just in case someone builds a Slicer-4.10 version)
