ParaView 5.8.1 crashing while importing 'Tensorflow'

Hello,

I am using Paraview to build a filter plugin for my university research project.
I built Paraview 5.8.1 from [source] (https://github.com/Kitware/ParaView/blob/master/Documentation/dev/build.md) which has Python 3.7. I was first trying to use ‘Programmable Filter’ to get an idea, so I
wrote a script in Programmable filter that starts with

import tensorflow as tf
import keras
import numpy, vtk


When I apply the filter, ParaView crashes with Segmentation Fault. So, I just opened a Python Shell in Paraview, and tried ‘import tensorflow’ and it crashed with this error:

Loguru caught a signal: SIGSEGV
Stack trace:
[truncated]
123 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
122 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
121 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
120 0x7f0dade0bcb9 _PyEval_EvalFrameDefault + 11449
119 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
118 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
117 0x7f0dade1010a _PyEval_EvalFrameDefault + 28938
116 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
115 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
114 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
113 0x7f0dade0fd61 _PyEval_EvalFrameDefault + 28001
112 0x7f0daded0466 _PyCFunction_FastCallDict + 38
111 0x7f0dadecfdd1 _PyMethodDef_RawFastCallDict + 801
110 0x7f0dade9e81e /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0xfb81e) [0x7f0dade9e81e]
109 0x7f0dade9a97c PyEval_EvalCode + 28
108 0x7f0dadfcbb0f PyEval_EvalCodeEx + 63
107 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
106 0x7f0dade0ff7a _PyEval_EvalFrameDefault + 28538
105 0x7f0dadef5577 PyImport_ImportModuleLevelObject + 1527
104 0x7f0daded0fea _PyObject_CallMethodIdObjArgs + 186
103 0x7f0daded0d43 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x12dd43) [0x7f0daded0d43]
102 0x7f0daded01c8 _PyFunction_FastCallDict + 472
101 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
100 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
99 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
98 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
97 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
96 0x7f0dade0fd61 _PyEval_EvalFrameDefault + 28001
95 0x7f0daded0590 PyCFunction_Call + 272
94 0x7f0dade9c9a6 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0xf99a6) [0x7f0dade9c9a6]
93 0x7f0dadef54b0 PyImport_ImportModuleLevelObject + 1328
92 0x7f0daded0fea _PyObject_CallMethodIdObjArgs + 186
91 0x7f0daded0d43 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x12dd43) [0x7f0daded0d43]
90 0x7f0daded02af _PyFunction_FastCallDict + 703
89 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
88 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
87 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
86 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
85 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
84 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
83 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
82 0x7f0dade0bcb9 _PyEval_EvalFrameDefault + 11449
81 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
80 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
79 0x7f0dade1010a _PyEval_EvalFrameDefault + 28938
78 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
77 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
76 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
75 0x7f0dade0fd61 _PyEval_EvalFrameDefault + 28001
74 0x7f0daded0466 _PyCFunction_FastCallDict + 38
73 0x7f0dadecfdd1 _PyMethodDef_RawFastCallDict + 801
72 0x7f0dade9e81e /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0xfb81e) [0x7f0dade9e81e]
71 0x7f0dade9a97c PyEval_EvalCode + 28
70 0x7f0dadfcbb0f PyEval_EvalCodeEx + 63
69 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
68 0x7f0dade0ff7a _PyEval_EvalFrameDefault + 28538
67 0x7f0dadef54b0 PyImport_ImportModuleLevelObject + 1328
66 0x7f0daded0fea _PyObject_CallMethodIdObjArgs + 186
65 0x7f0daded0d43 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x12dd43) [0x7f0daded0d43]
64 0x7f0daded02af _PyFunction_FastCallDict + 703
63 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
62 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
61 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
60 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
59 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
58 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
57 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
56 0x7f0dade0bcb9 _PyEval_EvalFrameDefault + 11449
55 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
54 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
53 0x7f0dade1010a _PyEval_EvalFrameDefault + 28938
52 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
51 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
50 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
49 0x7f0dade0fd61 _PyEval_EvalFrameDefault + 28001
48 0x7f0daded0466 _PyCFunction_FastCallDict + 38
47 0x7f0dadecfdd1 _PyMethodDef_RawFastCallDict + 801
46 0x7f0dade9e81e /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0xfb81e) [0x7f0dade9e81e]
45 0x7f0dade9a97c PyEval_EvalCode + 28
44 0x7f0dadfcbb0f PyEval_EvalCodeEx + 63
43 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
42 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
41 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
40 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
39 0x7f0dade1010a _PyEval_EvalFrameDefault + 28938
38 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
37 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
36 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
35 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
34 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
33 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
32 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
31 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
30 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
29 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
28 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
27 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
26 0x7f0dade0d808 _PyEval_EvalFrameDefault + 18440
25 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
24 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
23 0x7f0dade0bcb9 _PyEval_EvalFrameDefault + 11449
22 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
21 0x7f0dade11380 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6e380) [0x7f0dade11380]
20 0x7f0dade1010a _PyEval_EvalFrameDefault + 28938
19 0x7f0dade12116 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x6f116) [0x7f0dade12116]
18 0x7f0dadecff00 _PyFunction_FastCallKeywords + 144
17 0x7f0dadfcba1e _PyEval_EvalCodeWithName + 2782
16 0x7f0dade0fd61 _PyEval_EvalFrameDefault + 28001
15 0x7f0daded0466 _PyCFunction_FastCallDict + 38
14 0x7f0dadecfdd1 _PyMethodDef_RawFastCallDict + 801
13 0x7f0dadef7298 /home/drishti/anaconda3/envs/para/lib/libpython3.7m.so.1.0(+0x154298) [0x7f0dadef7298]
12 0x7f0dadef4b52 _PyImport_LoadDynamicModuleWithSpec + 338
11 0x7f0dadeec351 _PyImport_FindSharedFuncptr + 433
10 0x7f0daccc5051 dlopen + 113
9 0x7f0daccc5745 /lib/x86_64-linux-gnu/libdl.so.2(+0x1745) [0x7f0daccc5745]
8 0x7f0db26bf5af _dl_catch_error + 47
7 0x7f0db26bf51f _dl_catch_exception + 111
6 0x7f0daccc4f96 /lib/x86_64-linux-gnu/libdl.so.2(+0xf96) [0x7f0daccc4f96]
5 0x7f0db295d81a /lib64/ld-linux-x86-64.so.2(+0x1481a) [0x7f0db295d81a]
4 0x7f0db26bf51f _dl_catch_exception + 111
3 0x7f0db295e24f /lib64/ld-linux-x86-64.so.2(+0x1524f) [0x7f0db295e24f]
2 0x7f0db2959783 /lib64/ld-linux-x86-64.so.2(+0x10783) [0x7f0db2959783]
1 0x7f0d5583d263 google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*) + 3
0 0x7f0db2596fd0 /lib/x86_64-linux-gnu/libc.so.6(+0x3efd0) [0x7f0db2596fd0]
( 5.393s) [paraview ] :0 FATL| Signal: SIGSEGV
Segmentation fault (core dumped)

Then, I tried to check if I’m in the same environment in ParaView interpreter (PvPython) and Python in command line.

In command line (conda env para has tensorflow v2.3 installed):

import sys
sys.path
[’’, ‘/home/drishti/anaconda3/envs/para/lib/python37.zip’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7/lib-dynload’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7/site-packages’]

In Paraview python shell (./paraview/paraview_build/bin/pvpython):

sys.path
[’’, ‘/home/drishti/paraview/paraview_build/lib/python3.7/site-packages’, ‘/home/drishti/anaconda3/envs/para/lib/python37.zip’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7/lib-dynload’, ‘/home/drishti/anaconda3/envs/para/lib/python3.7/site-packages’]

And then, I tried ‘import tensorflow’ in both python. In ./pvpython, it crashes with the same segmentation fault, and in my normal command line python, it works.

However, in my paraview/paraview_build/bin/ directory, I also saw another executable ./pvtkpython, when I tried running it, it opens a python interpreter, and ‘import tensorflow’ works in this one.
I tried creating a symbolic link so that pvpython points to pvtkpython. But, that doesn’t solve the issue, and Paraview crashes again at import tensorflow.

How can I fix this issue?

My system details:
|Distributor ID:|Ubuntu|
|Description:|Ubuntu 18.04.5 LTS|
|Release:|18.04|
|Codename:|bionic|

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4