spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.3k stars 1.61k forks source link

Spyder 5.1.1 freezes trying open file #16239

Open Zincr0 opened 3 years ago

Zincr0 commented 3 years ago

Problem Description

Spyder completely freezes when clicking open file.

What steps reproduce the problem?

  1. Install the latest miniconda (python 3.9).
  2. Install spyder 5.1.1 from conda-forge:
  3. Click on open file.

What is the expected output? What do you see instead?

Spyder should show the file browser.

Spyder window completely freeezes, no log on terminal, no errors, no anything. The only possible thing to do is killing the process.

"spyder --safe-mode" changes nothing. "spyder --reset" changes nothing. Removing the entire .config/spyder-py3 folder changes nothing.

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.26.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.0 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.1.0 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso >=0.7.0;<0.9.0          :  0.8.2 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.10.0 (OK)
pylint >=2.5.0                :  2.7.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.2.1;<1.3.0          :  1.2.1 (OK)
pylsp_black >=1.0.0           :  None (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.0.3 (OK)
qtconsole >=5.1.0             :  5.1.1 (OK)
qtpy >=1.5.0                  :  1.10.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  52.0.0.post20210125 (OK)
sphinx >=0.6.6                :  4.1.2 (OK)
spyder_kernels >=2.1.0;<2.2.0 :  2.1.0 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.3 (OK)
xdg >=0.26                    :  0.27 (OK)
zmq >=17                      :  19.0.2 (OK)

# Optional:
cython >=0.21                 :  None (OK)
matplotlib >=2.0.0            :  None (OK)
numpy >=1.7                   :  None (OK)
pandas >=1.1.1                :  None (OK)
scipy >=0.17.0                :  None (OK)
sympy >=0.7.3                 :  None (OK)
ccordoba12 commented 3 years ago

Hey @Zincr0, thanks for reporting. Please open a terminal and post the result of this command here:

conda list
Zincr0 commented 3 years ago

conda list output:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
alabaster                 0.7.12                     py_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
argh                      0.26.2          pyh9f0ad1d_1002    conda-forge
arrow                     1.1.1              pyhd8ed1ab_0    conda-forge
astroid                   2.5.8            py39hf3d152e_0    conda-forge
async_generator           1.10                       py_0    conda-forge
atomicwrites              1.4.0              pyh9f0ad1d_0    conda-forge
attrs                     21.2.0             pyhd8ed1ab_0    conda-forge
autopep8                  1.5.7              pyhd8ed1ab_0    conda-forge
babel                     2.9.1              pyh44b312d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
binaryornot               0.4.4                      py_1    conda-forge
black                     21.7b0             pyhd8ed1ab_0    conda-forge
bleach                    4.0.0              pyhd8ed1ab_0    conda-forge
brotlipy                  0.7.0           py39h27cfd23_1003  
ca-certificates           2021.5.30            ha878542_0    conda-forge
certifi                   2021.5.30        py39hf3d152e_0    conda-forge
cffi                      1.14.6           py39h400218f_0  
chardet                   4.0.0           py39h06a4308_1003  
click                     8.0.1            py39hf3d152e_0    conda-forge
cloudpickle               1.6.0                      py_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
conda                     4.10.3           py39hf3d152e_0    conda-forge
conda-package-handling    1.7.3            py39h27cfd23_1  
cookiecutter              1.7.3              pyh6c4a22f_0    conda-forge
cryptography              3.4.7            py39hd23ed53_0  
dataclasses               0.8                pyhc8e2a94_3    conda-forge
dbus                      1.13.6               h48d8840_2    conda-forge
debugpy                   1.4.1            py39he80948d_0    conda-forge
decorator                 5.0.9              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
diff-match-patch          20200713           pyh9f0ad1d_0    conda-forge
docutils                  0.17.1           py39hf3d152e_0    conda-forge
entrypoints               0.3             pyhd8ed1ab_1003    conda-forge
expat                     2.4.1                h9c3ff4c_0    conda-forge
flake8                    3.9.2              pyhd8ed1ab_0    conda-forge
fontconfig                2.13.1            hba837de_1005    conda-forge
freetype                  2.10.4               h0708190_1    conda-forge
gettext                   0.19.8.1          h0b5b191_1005    conda-forge
glib                      2.68.3               h9c3ff4c_0    conda-forge
glib-tools                2.68.3               h9c3ff4c_0    conda-forge
gst-plugins-base          1.14.0               hbbd80ab_1  
gstreamer                 1.14.0               h28cd5cc_2  
icu                       58.2              hf484d3e_1000    conda-forge
idna                      2.10               pyhd3eb1b0_0  
imagesize                 1.2.0                      py_0    conda-forge
importlib-metadata        4.6.4            py39hf3d152e_0    conda-forge
importlib_metadata        4.6.4                hd8ed1ab_0    conda-forge
inflection                0.5.1              pyh9f0ad1d_0    conda-forge
intervaltree              3.0.2                      py_0    conda-forge
ipykernel                 6.2.0            py39hef51801_0    conda-forge
ipython                   7.26.0           py39hef51801_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
isort                     5.9.3              pyhd8ed1ab_0    conda-forge
jedi                      0.18.0           py39hf3d152e_2    conda-forge
jeepney                   0.7.1              pyhd8ed1ab_0    conda-forge
jinja2                    2.11.3             pyh44b312d_0    conda-forge
jinja2-time               0.2.0                      py_2    conda-forge
jpeg                      9d                   h36c2ea0_0    conda-forge
jsonschema                3.2.0              pyhd8ed1ab_3    conda-forge
jupyter_client            6.1.12             pyhd8ed1ab_0    conda-forge
jupyter_core              4.7.1            py39hf3d152e_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
keyring                   23.1.0           py39hf3d152e_0    conda-forge
lazy-object-proxy         1.6.0            py39h3811e60_0    conda-forge
ld_impl_linux-64          2.35.1               h7274673_9  
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.3.0               h5101ec6_17  
libglib                   2.68.3               h3e27bee_0    conda-forge
libgomp                   9.3.0               h5101ec6_17  
libiconv                  1.16                 h516909a_0    conda-forge
libpng                    1.6.37               h21135ba_2    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libspatialindex           1.9.3                h9c3ff4c_4    conda-forge
libstdcxx-ng              9.3.0               hd4cf53a_17  
libuuid                   2.32.1            h7f98852_1000    conda-forge
libxcb                    1.13              h7f98852_1003    conda-forge
libxml2                   2.9.12               h03d6c58_0  
markupsafe                1.1.1            py39h3811e60_3    conda-forge
matplotlib-inline         0.1.2              pyhd8ed1ab_2    conda-forge
mccabe                    0.6.1                      py_1    conda-forge
mistune                   0.8.4           py39h3811e60_1004    conda-forge
mypy_extensions           0.4.3            py39hf3d152e_3    conda-forge
nbclient                  0.5.4              pyhd8ed1ab_0    conda-forge
nbconvert                 6.1.0            py39hf3d152e_0    conda-forge
nbformat                  5.1.3              pyhd8ed1ab_0    conda-forge
ncurses                   6.2                  he6710b0_1  
nest-asyncio              1.5.1              pyhd8ed1ab_0    conda-forge
numpydoc                  1.1.0                      py_1    conda-forge
openssl                   1.1.1k               h7f98852_0    conda-forge
packaging                 21.0               pyhd8ed1ab_0    conda-forge
pandoc                    2.14.1               h7f98852_0    conda-forge
pandocfilters             1.4.2                      py_1    conda-forge
parso                     0.8.2              pyhd8ed1ab_0    conda-forge
pathspec                  0.9.0              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       21.1.3           py39h06a4308_0  
pluggy                    0.13.1           py39hf3d152e_4    conda-forge
poyo                      0.5.0                      py_0    conda-forge
prompt-toolkit            3.0.19             pyha770c72_0    conda-forge
psutil                    5.8.0            py39h3811e60_1    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pycodestyle               2.7.0              pyhd8ed1ab_0    conda-forge
pycosat                   0.6.3            py39h27cfd23_0  
pycparser                 2.20                       py_2  
pydocstyle                6.1.1              pyhd8ed1ab_0    conda-forge
pyflakes                  2.3.1              pyhd8ed1ab_0    conda-forge
pygments                  2.10.0             pyhd8ed1ab_0    conda-forge
pylint                    2.7.2            py39hf3d152e_0    conda-forge
pyls-spyder               0.4.0              pyhd8ed1ab_0    conda-forge
pyopenssl                 20.0.1             pyhd3eb1b0_1  
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.9.2            py39h2531618_6  
pyrsistent                0.17.3           py39h3811e60_2    conda-forge
pysocks                   1.7.1            py39h06a4308_0  
python                    3.9.5                h12debd9_4  
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-lsp-black          1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-jsonrpc        1.0.0              pyhd8ed1ab_0    conda-forge
python-lsp-server         1.2.1              pyhd8ed1ab_0    conda-forge
python-slugify            5.0.2              pyhd8ed1ab_0    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pytz                      2021.1             pyhd8ed1ab_0    conda-forge
pyxdg                     0.27               pyhd8ed1ab_0    conda-forge
pyyaml                    5.4.1            py39h3811e60_0    conda-forge
pyzmq                     19.0.2           py39hb69f2a1_2    conda-forge
qdarkstyle                3.0.2              pyhd8ed1ab_0    conda-forge
qstylizer                 0.2.1              pyhd8ed1ab_0    conda-forge
qt                        5.9.7                h5867ecd_1  
qtawesome                 1.0.3              pyhd8ed1ab_0    conda-forge
qtconsole                 5.1.1              pyhd8ed1ab_0    conda-forge
qtpy                      1.10.0             pyhd8ed1ab_0    conda-forge
readline                  8.1                  h27cfd23_0  
regex                     2021.8.3         py39h3811e60_0    conda-forge
requests                  2.25.1             pyhd3eb1b0_0  
rope                      0.19.0             pyhd8ed1ab_0    conda-forge
rtree                     0.9.7            py39hb102c33_2    conda-forge
ruamel_yaml               0.15.100         py39h27cfd23_0  
secretstorage             3.3.1            py39hf3d152e_0    conda-forge
setuptools                52.0.0           py39h06a4308_0  
sip                       4.19.13          py39h2531618_0  
six                       1.16.0             pyhd3eb1b0_0  
snowballstemmer           2.1.0              pyhd8ed1ab_0    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
sphinx                    4.1.2              pyh6c4a22f_1    conda-forge
sphinxcontrib-applehelp   1.0.2                      py_0    conda-forge
sphinxcontrib-devhelp     1.0.2                      py_0    conda-forge
sphinxcontrib-htmlhelp    2.0.0              pyhd8ed1ab_0    conda-forge
sphinxcontrib-jsmath      1.0.1                      py_0    conda-forge
sphinxcontrib-qthelp      1.0.3                      py_0    conda-forge
sphinxcontrib-serializinghtml 1.1.5              pyhd8ed1ab_0    conda-forge
spyder                    5.1.1            py39hf3d152e_0    conda-forge
spyder-kernels            2.1.0            py39hf3d152e_0    conda-forge
sqlite                    3.36.0               hc218d9a_0  
testpath                  0.5.0              pyhd8ed1ab_0    conda-forge
text-unidecode            1.3                        py_0    conda-forge
textdistance              4.2.1              pyhd8ed1ab_0    conda-forge
three-merge               0.1.1              pyh9f0ad1d_0    conda-forge
tinycss2                  1.1.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.10               hbc83047_0  
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     1.2.1              pyhd8ed1ab_0    conda-forge
tornado                   6.1              py39h3811e60_1    conda-forge
tqdm                      4.61.2             pyhd3eb1b0_1  
traitlets                 5.0.5                      py_0    conda-forge
typed-ast                 1.4.3            py39h3811e60_0    conda-forge
typing_extensions         3.10.0.0           pyha770c72_0    conda-forge
tzdata                    2021a                h52ac0ba_0  
ujson                     4.0.2            py39he80948d_0    conda-forge
unidecode                 1.2.0              pyhd8ed1ab_0    conda-forge
urllib3                   1.26.6             pyhd3eb1b0_1  
watchdog                  2.1.3            py39hf3d152e_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.36.2             pyhd3eb1b0_0  
wrapt                     1.12.1           py39h3811e60_3    conda-forge
wurlitzer                 2.1.1            py39hf3d152e_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.2.5                h7b6447c_0  
yaml                      0.2.5                h7b6447c_0  
yapf                      0.31.0             pyhd8ed1ab_0    conda-forge
zeromq                    4.3.4                h9c3ff4c_0    conda-forge
zipp                      3.5.0              pyhd8ed1ab_0    conda-forge
zlib                      1.2.11               h7b6447c_3  
ccordoba12 commented 3 years ago

Your environment has a mix of conda-forge and defaults package, which is a really bad thing to do because those packages are (for the most part) binary incompatible. I think that's the cause of the odd error you're seeing.

So please try again by creating a new environment from scratch with the following commands:

conda create -n new-env -c conda-forge spyder
conda activate new-env
spyder
Zincr0 commented 3 years ago

Ok I found a way to recreate the bug, with the kio-fuse package installed:

Tested on both, mixed and conda-forge only environment.

Edit: I mean, is a workaround, rebooting the entire pc just to open a different file is a little too much.

Edit 2: better steps to reproduce the problem.

ccordoba12 commented 3 years ago

Thanks for letting us know how to reproduce this problem. We simply use the default open dialogs provided by Qt/PyQt, so I'd say it's a problem with them.

I understand this is a very annoying bug, but we're a small team and this seems like a very fringe case. So it's very low priority for us, sorry.

Zincr0 commented 3 years ago

If you leave some hints here about what and where to look, maybe i can find a better workaround or even tweak some code

ccordoba12 commented 3 years ago

You can take a look at the load method of the Editor class in spyder/plugins/editor/plugin.py:

https://github.com/spyder-ide/spyder/blob/cb346166a713dcf8e2278951c5ddc96e8337d203/spyder/plugins/editor/plugin.py#L2063-L2077

ccordoba12 commented 3 years ago

The function getopenfilenames in that method is the one we use to show an open dialog to users.

derek-v-s commented 2 years ago

On Fedora 36/Gnome when you try to open a file a system notification comes down from the the top center of the screen. It has a title Portal and says "Open file" is ready. Clicking on that will make the file browser appear. Before that, the file browser is created behind the main window. Since the user doesn't know the file browser is behind the main window, and it's blocking input to the main window, the program appears to be frozen.

Python 3.10.6 64-bit | Qt 5.15.5 | PyQt5 5.15.6 | Linux 5.18.17-200.fc36.x86_64 Gnome 42.3 - Wayland Spider 5.2.1

ccordoba12 commented 2 years ago

@derek-v-s, problems with Linux distros need to be reported with them because we don't have control on the way they package Spyder and its dependencies.

If you want to avoid that error, please install Spyder in a virtualenv with pip or download Anaconda/Miniconda.