tpaviot / pythonocc-core

Python package for 3D geometry CAD/BIM/CAM
GNU Lesser General Public License v3.0
1.39k stars 380 forks source link

Segmentation fault at init_display #1098

Open Ma-Weijian opened 2 years ago

Ma-Weijian commented 2 years ago

Hi PythonOCC team,

Wonderful python interface for OpenCASCADE! It does help me a lot.

I run PythonOCC at an old machine and everything works fine.

However, when I moved to a new machine. I meet segmentation fault every time I call function init_display.

The output looks like this.

/home/mwj/DeepCAD_pointnet_test/proj_log/newDeepCAD/results
qt-pyqt5 backend - Qt version 5.9.6
####### 3D rendering pipe initialisation #####
Display3d class initialization starting ...
Aspect_DisplayConnection created.
OpenGl_GraphicDriver created.
V3d_Viewer created.
AIS_InteractiveContext created.
V3d_View created
段错误 (核心已转储)

(The last line is just segmentation fault (core dumped) in Chinese)

I tried to locate the error and found that it happened at line 196 in SimpleGUI.py, or to say the following line in function init_display.

        win.show()

I tried some other qt programs in the same virtual environment, they all work fine.

My computer only has an RTX 3090 graphics card and uses 510.39.01 as its grahics card driver. Its OS is ubuntu 20.04.

Any idea helps. A million thanks!

P.S. The result of conda list is shown as follows.

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             4.5                       1_gnu    defaults
absl-py                   0.15.0             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
aiohttp                   3.8.1            py37h7f8727e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
aiosignal                 1.2.0              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
antlr-python-runtime      4.8              py37hc8dfbb8_2    conda-forge
async-timeout             4.0.1              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
asynctest                 0.13.0                     py_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
attrs                     21.2.0             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
blas                      1.0                         mkl    defaults
blinker                   1.4              py37h06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
bottleneck                1.3.2            py37heb32a55_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
brotli                    1.0.9                he6710b0_2    defaults
brotlipy                  0.7.0           py37h27cfd23_1003    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
bzip2                     1.0.8                h7b6447c_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
c-ares                    1.17.1               h7f98852_1    conda-forge
ca-certificates           2021.10.26           h06a4308_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cached-property           1.5.2                      py_0    defaults
cachetools                4.2.2              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cairo                     1.16.0               hf32fb01_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
certifi                   2021.10.8        py37h06a4308_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cffi                      1.14.6           py37h400218f_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
charset-normalizer        2.0.4              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
click                     8.0.3              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cryptography              3.4.8            py37hd23ed53_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
cudatoolkit               11.3.1               h2bc3f7f_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
curl                      7.78.0               hea6ffbf_0    conda-forge
cycler                    0.11.0             pyhd3eb1b0_0    defaults
cython                    0.29.25          py37hdbfa776_0    defaults
daal                      2020.3             ha770c72_304    conda-forge
daal4py                   2020.3.1         py37hba267e2_0    conda-forge
dataclasses               0.8                pyh6d0b6a4_7    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
dbus                      1.13.18              hb2f20db_0    defaults
double-conversion         3.1.5                h9c3ff4c_2    conda-forge
eigen                     3.3.9                h4bd325d_1    conda-forge
einops                    0.4.0              pyhd8ed1ab_0    conda-forge
expat                     2.4.1                h2531618_2    defaults
ffmpeg                    4.3.2                hca11adc_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.13.1               h6c09931_0    defaults
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.25.0             pyhd3eb1b0_0    defaults
freeimage                 3.18.0               h88c329d_7    conda-forge
freetype                  2.11.0               h70c0345_0    defaults
fribidi                   1.0.10               h7b6447c_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
frozenlist                1.2.0            py37h7f8727e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
fsspec                    2022.1.0           pyhd8ed1ab_0    conda-forge
future                    0.18.2           py37h89c1867_4    conda-forge
gettext                   0.21.0               hf68c758_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
giflib                    5.2.1                h7b6447c_0    defaults
gl2ps                     1.4.2                h0708190_0    conda-forge
glew                      2.1.0                h9c3ff4c_2    conda-forge
glib                      2.69.1               h5202010_0    defaults
gmp                       6.2.1                h2531618_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
gnutls                    3.6.15               he1e5248_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
google-auth               1.33.0             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
google-auth-oauthlib      0.4.1                      py_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
graphite2                 1.3.14               h23475e2_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
grpcio                    1.42.0           py37hce63b2e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
gst-plugins-base          1.14.0               h8213a91_2    defaults
gstreamer                 1.14.0               h28cd5cc_2    defaults
h5py                      3.6.0            py37ha0f2276_0    defaults
harfbuzz                  2.8.1                h6f93f22_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
hdf4                      4.2.15               h10796ff_3    conda-forge
hdf5                      1.10.6          nompi_h7c3c948_1111    conda-forge
hydra-core                1.1.1              pyhd8ed1ab_0    conda-forge
icu                       58.2                 he6710b0_3    defaults
idna                      3.3                pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
ilmbase                   2.5.5                h780b84a_0    conda-forge
importlib-metadata        4.8.2            py37h06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
intel-openmp              2021.4.0          h06a4308_3561    defaults
joblib                    1.1.0              pyhd3eb1b0_0    defaults
jpeg                      9d                   h7f8727e_0    defaults
jsoncpp                   1.9.4                h4bd325d_3    conda-forge
jxrlib                    1.1                  h7f98852_2    conda-forge
kiwisolver                1.3.1            py37h2531618_0    defaults
krb5                      1.19.2               hcc1bbae_0    conda-forge
lame                      3.100                h7b6447c_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
lcms2                     2.12                 h3be6417_0    defaults
ld_impl_linux-64          2.35.1               h7274673_9    defaults
libcurl                   7.78.0               h2574ce0_0    conda-forge
libedit                   3.1.20210910         h7f8727e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.3                  he6710b0_2    defaults
libgcc-ng                 9.3.0               h5101ec6_17    defaults
libgfortran-ng            7.5.0               ha8ba4b0_17    defaults
libgfortran4              7.5.0               ha8ba4b0_17    defaults
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   9.3.0               h5101ec6_17    defaults
libiconv                  1.15                 h63c8f33_5    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libidn2                   2.3.2                h7f8727e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libnetcdf                 4.8.0           nompi_hcd642e3_103    conda-forge
libnghttp2                1.43.0               h812cca2_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libpng                    1.6.37               hbc83047_0    defaults
libprotobuf               3.19.1               h4ff587b_0    defaults
libraw                    0.20.2               h10796ff_1    conda-forge
libssh2                   1.9.0                ha56f1ee_6    conda-forge
libstdcxx-ng              9.3.0               hd4cf53a_17    defaults
libtasn1                  4.16.0               h27cfd23_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libtheora                 1.1.1             h7f98852_1005    conda-forge
libtiff                   4.2.0                h85742a9_0    defaults
libunistring              0.9.10               h27cfd23_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libuuid                   1.0.3                h7f8727e_2    defaults
libuv                     1.40.0               h7b6447c_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libwebp                   1.2.0                h89dd481_0    defaults
libwebp-base              1.2.0                h27cfd23_0    defaults
libxcb                    1.14                 h7b6447c_0    defaults
libxml2                   2.9.12               h03d6c58_0    defaults
libzip                    1.8.0                h4de3113_0    conda-forge
lmdb                      0.9.29               h2531618_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
loguru                    0.5.3            py37h89c1867_3    conda-forge
lz4-c                     1.9.3                h295c915_1    defaults
markdown                  3.3.4            py37h06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
matplotlib                3.5.0            py37h06a4308_0    defaults
matplotlib-base           3.5.0            py37h3ed280b_0    defaults
mkl                       2021.4.0           h06a4308_640    defaults
mkl-service               2.4.0            py37h7f8727e_0    defaults
mkl_fft                   1.3.1            py37hd3c417c_0    defaults
mkl_random                1.2.2            py37h51133e4_0    defaults
mpi                       1.0                       mpich    defaults
mpich                     3.3.2                hc856adb_0    defaults
msgpack-numpy             0.4.7.1            pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
msgpack-python            1.0.2            py37hff7bd54_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
multidict                 5.2.0            py37h7f8727e_2    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
munkres                   1.1.4                      py_0    defaults
ncurses                   6.3                  h7f8727e_2    defaults
nettle                    3.7.3                hbbd107a_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numexpr                   2.8.1            py37h6abb31d_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
numpy                     1.21.2           py37h20f2e39_0    defaults
numpy-base                1.21.2           py37h79a1101_0    defaults
oauthlib                  3.1.1              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
occt                      7.5.1                h7391655_2    conda-forge
olefile                   0.46                     py37_0    defaults
omegaconf                 2.1.1            py37h89c1867_1    conda-forge
openexr                   2.5.5                hf817b99_0    conda-forge
openh264                  2.1.1                h4ff587b_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
openjpeg                  2.4.0                hb52868f_1    conda-forge
openssl                   1.1.1m               h7f8727e_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
packaging                 21.3               pyhd3eb1b0_0    defaults
pandas                    1.3.4            py37h8c16a72_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pango                     1.45.3               hd140c19_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pcre                      8.45                 h295c915_0    defaults
pillow                    8.4.0            py37h5aabda8_0    defaults
pip                       21.2.2           py37h06a4308_0    defaults
pixman                    0.40.0               h7f8727e_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
plyfile                   0.7.4              pyhd8ed1ab_0    conda-forge
pointnet2                 3.0.0                    pypi_0    pypi
pointnet2-ops             3.0.0                    pypi_0    pypi
proj                      7.2.0                h277dcde_2    conda-forge
protobuf                  3.19.1           py37h295c915_0    defaults
pugixml                   1.11.4               h9c3ff4c_0    conda-forge
pyasn1                    0.4.8              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyasn1-modules            0.2.8                    pypi_0    pypi
pycparser                 2.21               pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pydeprecate               0.3.1                    pypi_0    pypi
pyjwt                     2.1.0            py37h06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyopenssl                 21.0.0             pyhd3eb1b0_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyparsing                 3.0.4              pyhd3eb1b0_0    defaults
pyqt                      5.9.2            py37h05f1152_2    defaults
pysocks                   1.7.1                    py37_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
python                    3.7.11               h12debd9_0    defaults
python-dateutil           2.8.2              pyhd3eb1b0_0    defaults
python-lmdb               0.99             py37hcd2ae1e_0    conda-forge
python_abi                3.7                     2_cp37m    conda-forge
pythonocc-core            7.5.1            py37h39293ed_0    conda-forge
pytorch                   1.10.1          py3.7_cuda11.3_cudnn8.2.0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
pytorch-lightning         1.5.9              pyhd8ed1ab_0    conda-forge
pytorch-mutex             1.0                        cuda    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
pytz                      2021.3             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
pyyaml                    5.4.1            py37h5e8e339_0    conda-forge
qt                        5.9.7                h5867ecd_1    defaults
rapidjson                 1.1.0             he1b5a44_1002    conda-forge
readline                  8.1.2                h7f8727e_1    defaults
requests                  2.27.1             pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
requests-oauthlib         1.3.0                      py_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
rsa                       4.7.2              pyhd3eb1b0_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
scikit-learn              1.0.2            py37h51133e4_0    defaults
scikit-learn-intelex      2021.2.1         py37h89c1867_1    conda-forge
scipy                     1.7.3            py37hc147768_0    defaults
setuptools                59.5.0                   pypi_0    pypi
sip                       4.19.8           py37hf484d3e_0    defaults
six                       1.16.0             pyhd3eb1b0_0    defaults
sqlite                    3.37.0               hc218d9a_0    defaults
tbb                       2020.2               h4bd325d_4    conda-forge
tbb-devel                 2020.2               h4bd325d_4    conda-forge
tensorboard               2.6.0                      py_1    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorboard-data-server   0.6.0            py37hca6d32c_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorboard-plugin-wit    1.6.0                      py_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
tensorboardx              2.2                pyhd3eb1b0_0    defaults
threadpoolctl             2.2.0              pyh0d69192_0    defaults
tk                        8.6.11               h1ccaba5_0    defaults
torchaudio                0.10.1               py37_cu113    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
torchmetrics              0.7.0              pyhd8ed1ab_0    conda-forge
torchvision               0.11.2               py37_cu113    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch
tornado                   6.1              py37h27cfd23_0    defaults
tqdm                      4.62.3             pyhd3eb1b0_1    defaults
trimesh                   3.9.39             pyh6c4a22f_0    conda-forge
typing-extensions         3.10.0.2             hd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
typing_extensions         3.10.0.2           pyh06a4308_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
urllib3                   1.26.8                   pypi_0    pypi
utfcpp                    3.2.1                ha770c72_0    conda-forge
vtk                       9.0.1           no_osmesa_py37h111716f_107    conda-forge
werkzeug                  2.0.2              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
wheel                     0.37.1                   pypi_0    pypi
wxpython                  4.0.4            py37hc99224d_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
x264                      1!161.3030           h7f98852_1    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.2                h470a237_5    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxt                1.2.1                h7f98852_2    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h7b6447c_0    defaults
yaml                      0.2.5                h516909a_0    conda-forge
yarl                      1.6.3            py37h27cfd23_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zipp                      3.7.0              pyhd3eb1b0_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
zlib                      1.2.11               h7f8727e_4    defaults
zstd                      1.4.9                haebb681_0    defaults
cafhach commented 2 years ago

Are you using a remote desktop solution?

Ma-Weijian commented 2 years ago

Unfortunately not.

cafhach commented 2 years ago

Can you run your program using software rendering (i.e. mesa) instead of hardware-accelerated opengl? According to https://docs.mesa3d.org/envvars.html you can enforce use of software rendering by setting env var LIBGL_ALWAYS_SOFTWARE

export LIBGL_ALWAYS_SOFTWARE = true

If your program then runs without segfault, the issue might be caused by an issue of the graphics driver.

Ma-Weijian commented 2 years ago

Thanks @cafhach , I will have a try.

Ma-Weijian commented 2 years ago

Well, unfortunately this doesn't help.

export LIBGL_ALWAYS_SOFTWARE = true

I've also noticed that the faulty machine may have detected a faulty version of qt as shown below.

/home/mwj/DeepCAD_pointnet_test/proj_log/newDeepCAD/results
qt-pyqt5 backend - Qt version 5.9.6
####### 3D rendering pipe initialisation #####
...

while my qt version in the virtual environment is 5.9.7. What seems more weird is that I did not find any qt with version 5.9.6 in this machine.

I don't have any idea about what's going on. Is qt version mismatch the reason for this segmentation fault?

Anything helps @cafhach. A million thanks.