schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.2k stars 281 forks source link

Closing pymol which started from python console crashes python #204

Open stefdoerr opened 3 years ago

stefdoerr commented 3 years ago

Hi, I tried a fresh install of pymol-open-source=2.5.0. If you then open a python console and start pymol with the following commands as per instructions

import pymol
pymol.finish_launching(["pymol", "-q"])

Pymol opens up correctly. Now if you click on X to close pymol it hangs. After a while the OS asks you to kill the process, and when you kill pymol it doesn't just kill pymol but also the python console. Honestly I don't mind if pymol crashes but when it takes with it the python console it takes also any work you were doing there which is a bit problematic.

I made a GIF to demonstrate it Peek 2021-11-14 10-08

Thanks in advance! I attach the environment:

$ conda list
# packages in environment at /home/sdoerr/miniconda3/envs/pymol_test:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
alsa-lib                  1.2.3                h516909a_0    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2021.10.8            ha878542_0    conda-forge
curl                      7.80.0               h2574ce0_0    conda-forge
dbus                      1.13.6               h48d8840_2    conda-forge
expat                     2.4.1                h9c3ff4c_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
glew                      2.1.0                h9c3ff4c_2    conda-forge
glib                      2.70.0               h780b84a_1    conda-forge
glib-tools                2.70.0               h780b84a_1    conda-forge
glm                       0.9.9.4              hc9558a2_0    conda-forge
gst-plugins-base          1.18.5               hf529b03_2    conda-forge
gstreamer                 1.18.5               h9f60fe5_2    conda-forge
hdf4                      4.2.15               h10796ff_3    conda-forge
hdf5                      1.10.6          nompi_h6a2412b_1114    conda-forge
icu                       68.2                 h9c3ff4c_0    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
krb5                      1.19.2               hcc1bbae_3    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libblas                   3.9.0           12_linux64_openblas    conda-forge
libcblas                  3.9.0           12_linux64_openblas    conda-forge
libclang                  11.1.0          default_ha53f305_1    conda-forge
libcurl                   7.80.0               h2574ce0_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libgfortran-ng            11.2.0              h69a702a_11    conda-forge
libgfortran5              11.2.0              h5c6108e_11    conda-forge
libglib                   2.70.0               h174f98d_1    conda-forge
libglu                    9.0.0             he1b5a44_1001    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0           12_linux64_openblas    conda-forge
libllvm11                 11.1.0               hf817b99_2    conda-forge
libnetcdf                 4.7.4           nompi_h56d31a8_107    conda-forge
libnghttp2                1.43.0               h812cca2_1    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libogg                    1.3.4                h7f98852_1    conda-forge
libopenblas               0.3.18          pthreads_h8fe5266_0    conda-forge
libopus                   1.3.1                h7f98852_1    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libpq                     13.3                 hd57d9b9_3    conda-forge
libssh2                   1.10.0               ha56f1ee_2    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libvorbis                 1.3.7                h9c3ff4c_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.12               h72842e0_0    conda-forge
libzlib                   1.2.11            h36c2ea0_1013    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
mysql-common              8.0.27               ha770c72_1    conda-forge
mysql-libs                8.0.27               hfa10184_1    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nspr                      4.32                 h9c3ff4c_1    conda-forge
nss                       3.72                 hb5efdd6_0    conda-forge
numpy                     1.21.4           py38he2449b9_0    conda-forge
openssl                   1.1.1l               h7f98852_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pip                       21.3.1             pyhd8ed1ab_0    conda-forge
pmw                       2.0.1           py38h578d9bd_1004    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
pymol-open-source         2.5.0            py38h8341299_4    conda-forge
pyqt                      5.12.3           py38h578d9bd_8    conda-forge
pyqt-impl                 5.12.3           py38h0ffb2e6_8    conda-forge
pyqt5-sip                 4.19.18          py38h709712a_8    conda-forge
pyqtchart                 5.12             py38h7400c14_8    conda-forge
pyqtwebengine             5.12.1           py38h7400c14_8    conda-forge
python                    3.8.12          hb7a2778_2_cpython    conda-forge
python_abi                3.8                      2_cp38    conda-forge
qt                        5.12.9               hda022c4_4    conda-forge
readline                  8.1                  h46c0cb4_0    conda-forge
setuptools                58.5.3           py38h578d9bd_0    conda-forge
sqlite                    3.36.0               h9cd32fc_2    conda-forge
tk                        8.6.11               h27826a3_1    conda-forge
wheel                     0.37.0             pyhd8ed1ab_1    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libx11               1.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
zlib                      1.2.11            h36c2ea0_1013    conda-forge
zstd                      1.5.0                ha95c52a_0    conda-forge
TstewDev commented 3 years ago

Hello @stefdoerr, thanks for leaving such a clear explanation and gif! I'll have to look into what's causing this but, in the mean time, does the PyMOL command quit work?

stefdoerr commented 3 years ago

No, quit and cmd.quit() also crashes pymol and python

TstewDev commented 3 years ago

Okay thanks! That helps narrow down what it could be. I'll update you here if we find the issue.

stefdoerr commented 2 years ago

Hi, is there any progress on this issue? Could I help somehow in resolving it?

stefdoerr commented 2 years ago

I did some debugging. The error comes from trying to join the reaper thread. Specifically it's this line here which hangs: https://github.com/schrodinger/pymol-open-source/blob/master/modules/pymol/internal.py#L534

If I comment out that line it doesn't hang anymore but quitting pymol automatically also instantly kills the ipython console