# Slicer crashes after installing and importing tensorflow on linux

**URL:** <https://discourse.slicer.org/t/slicer-crashes-after-installing-and-importing-tensorflow-on-linux/34259>\
**Category:** Development\
**Created:** [February 12, 2024, 4:22pm UTC](https://discourse.slicer.org/t/slicer-crashes-after-installing-and-importing-tensorflow-on-linux/34259 "2024-02-12T16:22:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CyprienB](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cyprienb/32/66306_2.png) [@CyprienB](https://discourse.slicer.org/u/CyprienB)\
**Post date:** [February 12, 2024, 4:22pm UTC](https://discourse.slicer.org/t/slicer-crashes-after-installing-and-importing-tensorflow-on-linux/34259/1 "2024-02-12T16:22:18Z")

</div>

Operating system: Fedora Linux 39  
Slicer version: Slicer-5.6.1  
Expected behavior: Import tensorflow from a python extension  
Actual behavior: Slicer crashes after installing tensorflow

Hello,  
After installing Slicer-5.6.1 on linux, I have created a new extension **TestExtension** using the Extension Wizard module in which I have added a new module **TestModule**. Then, I have installed the latest version of tensorflow (2.15.0.post1) using the synthax pip\_install(‘tensorflow’) in the python console. When I restart Slicer, everything works fine. Then I added on the python file TestExtension/TestModuleTestModule.py the line “import tensorflow as tf”. After doing that I cannot restart Slicer as it crashes everytime with the following code:

 ![Report_error](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/7/374a82b8bb22b4d926374a3a9c7f03192b35a402.png)

---

<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:** [February 12, 2024, 5:13pm UTC](https://discourse.slicer.org/t/slicer-crashes-after-installing-and-importing-tensorflow-on-linux/34259/2 "2024-02-12T17:13:25Z")

</div>

The medical image computing research community seems to have moved away from TensorFlow/Keras and standardized on using pytorch. Pytorch has become critically important for Slicer community as well, many users on many types of computers, GPUs, operating systems test it and we quickly fix any problems that arise.

In contrast, there might be a few extensions that use tensorflow for historical reasons, but they are not widely used and I’m not sure how well supported. Probably they all run tensorflow in an external Python environment. Of course this is really inconvenient for end users, as users don’t want to install Python and set up virtual python environments.

Overall, if you work in the medical image computing field then you might consider switching to using pytorch, as you will be part of a larger community and it will probably make your life easier.

---

<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:** [February 12, 2024, 6:29pm UTC](https://discourse.slicer.org/t/slicer-crashes-after-installing-and-importing-tensorflow-on-linux/34259/3 "2024-02-12T18:29:58Z")

</div>

The below Google search interest metrics seems to support the idea that PyTorch has become more preferred than Tensorflow since 2021.  
[https://trends.google.com/trends/explore?date=2016-01-12%202024-02-12&q=pytorch,tensorflow&hl=en](https://trends.google.com/trends/explore?date=2016-01-12%202024-02-12&q=pytorch,tensorflow&hl=en)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/3/a/3af26adfdef22660dc2665e4e0a3d4e4821c248e.png)
