spyder-ide / spyder

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

spyder crashes/hangs repeatedly #20867

Closed mczakk closed 1 year ago

mczakk commented 1 year ago

Issue Report Checklist

Problem Description

when running any script spyder will just hang after producing the runfile ('xxxx', wdir='xxx', current_namespace=True) message in the console. I can still enter type into the editor, but clicking the red square int the console does nothing. I can click on restart kernel, sometimes this will allow the script to run, sometimes not. generally I have to close and re-open spyder, but this does not always work.

What steps reproduce the problem?

  1. Running any script

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

nothing, it is currently hung, and I have copied the spyder version info and dependencies while it is 'running'. attached is a screenshot of the console spyderbad

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0                             :  1.4.1 (OK)
chardet >=2.0.0                                  :  5.1.0 (OK)
cloudpickle >=0.5.0                              :  2.2.1 (OK)
cookiecutter >=1.6.0                             :  2.1.1 (OK)
diff_match_patch >=20181111                      :  20200713 (OK)
intervaltree >=3.0.2                             :  3.0.2 (OK)
IPython >=7.31.1,<9.0.0,!=8.8.0,!=8.9.0,!=8.10.0 :  8.12.0 (OK)
jedi >=0.17.2,<0.19.0                            :  0.18.2 (OK)
jellyfish >=0.7                                  :  0.9.0 (OK)
jsonschema >=3.2.0                               :  4.17.3 (OK)
keyring >=17.0.0                                 :  23.13.1 (OK)
nbconvert >=4.0                                  :  7.3.1 (OK)
numpydoc >=0.6.0                                 :  1.5.0 (OK)
paramiko >=2.4.0                                 :  3.1.0 (OK)
parso >=0.7.0,<0.9.0                             :  0.8.3 (OK)
pexpect >=4.4.0                                  :  4.8.0 (OK)
pickleshare >=0.4                                :  0.7.5 (OK)
psutil >=5.3                                     :  5.9.4 (OK)
pygments >=2.0                                   :  2.15.0 (OK)
pylint >=2.5.0,<3.0                              :  2.17.2 (OK)
pylint_venv >=2.1.1                              :  3.0.1 (OK)
pyls_spyder >=0.4.0                              :  0.4.0 (OK)
pylsp >=1.7.2,<1.8.0                             :  1.7.2 (OK)
pylsp_black >=1.2.0                              :  1.2.1 (OK)
qdarkstyle >=3.0.2,<3.2.0                        :  3.1 (OK)
qstylizer >=0.2.2                                :  0.2.2 (OK)
qtawesome >=1.2.1                                :  1.2.3 (OK)
qtconsole >=5.4.2,<5.5.0                         :  5.4.2 (OK)
qtpy >=2.1.0                                     :  2.3.1 (OK)
rtree >=0.9.7                                    :  1.0.1 (OK)
setuptools >=49.6.0                              :  67.6.1 (OK)
sphinx >=0.6.6                                   :  6.1.3 (OK)
spyder_kernels >=2.4.3,<2.5.0                    :  2.4.3 (OK)
textdistance >=4.2.0                             :  4.5.0 (OK)
three_merge >=0.1.1                              :  0.1.1 (OK)
watchdog >=0.10.3                                :  3.0.0 (OK)
zmq >=22.1.0                                     :  25.0.2 (OK)

# Optional:
cython >=0.21                                    :  0.29.34 (OK)
matplotlib >=3.0.0                               :  3.7.1 (OK)
numpy >=1.7                                      :  1.24.2 (OK)
pandas >=1.1.1                                   :  2.0.0 (OK)
scipy >=0.17.0                                   :  1.10.1 (OK)
sympy >=0.7.3                                    :  1.11.1 (OK)
ccordoba12 commented 1 year ago

Hey @mczakk, thanks for reporting. What Matplotlib backend are you using to generate your plots? It's ok if you don't know what that is, but that could be the cause of your issues.

mczakk commented 1 year ago

Hi @ccordoba12, unfortunately i'm not sure, and can't find out as I switched from using Anaconda to a standalone install using pip. so far there have been no issues :) I am uncertain as to whether the matplotlib backend was causing the issue as it was occurring across all scripts, even those which did not call matplotlib at all (if that helps)

ccordoba12 commented 1 year ago

Ok, then please open a system terminal (i.e. cmd.exe) and run there

spyder --reset

and try again. Perhaps that solves the problem for you.

mczakk commented 1 year ago

Ok, then please open a system terminal (i.e. cmd.exe) and run there

spyder --reset

and try again. Perhaps that solves the problem for you.

Not sure what this will achieve, as I said, I have uninstalled Anaconda and it's associated version of Spyder, and installed standalone spyder using pip. This seems to be working ok :)

ccordoba12 commented 1 year ago

Not sure what this will achieve

That won't uninstall Spyder, it will reset its configuration options to its factory defaults. That could help to fix the problem you're seeing.

gica3618 commented 1 year ago

I was having the same problem. I uninstalled and re-installed Anaconda, but no success. However, running spyder --reset fixed it!

gica3618 commented 1 year ago

Celebrated too soon... When I activate the option "Remove all variables before execution" in the settings, it hangs again. Disabling the option makes it work again. Is there a solution to this problem?

ccordoba12 commented 1 year ago

Thanks for the extra info @gica3618! This means that this is a duplicate of issue #16138 and we'll try to fix it in Spyder 6, to be released during the second half of the year.

ccordoba12 commented 1 year ago

For now you can't use that option because it's broken, sorry.

K4-z3 commented 1 year ago

I had the same issue. Setting the graphics backend as Inline or Tkinter seems to have fixed the problem for me, for the moment. I have that issue every time I set it as qt5 or Automatic (tried several times).

ccordoba12 commented 1 year ago

@K4-z3, that was a problem with older Spyder versions. If you're using the latest one (5.4.3), you shouldn't see it.

K4-z3 commented 1 year ago

@K4-z3, that was a problem with older Spyder versions. If you're using the latest one (5.4.3), you shouldn't see it.

I'm currently using Spyder 5.4.3 with Python 3.8.16, Qt 5.15.2 and PyQt5 5.15.7 and apparently still got the issue.

mczakk commented 1 year ago

Not sure what this will achieve

That won't uninstall Spyder, it will reset its configuration options to its factory defaults. That could help to fix the problem you're seeing.

I think we have crossed wires! I had already uninstalled my Anaconda install (and obviously spyder with it) before you replied. I'm now running standalone Spyder via a pip install with Python 3.11 with only minor issues (which I will post as another issue) and so would suggest that the issue I was having may well be connected to Anaconda in some way?

ccordoba12 commented 1 year ago

@K4-z3, please open a new issue about your problem and don't forget to fill all the info required by our issue template.

DiegoRodasRodriguez commented 20 hours ago

Hi @ccordoba12 I saw you mentioned that the issue should be fixed for Spyder v5.4.3 and above, but I am currently using (5.51) with Python 3.12.4 64-bit | Qt 5.15.2 | PyQt5 5.15.10 and I have the same problem about Qt5. If my backend is set to Qt5 my console freezes and if I change to Automatic or Inline it seems to work properly.

ccordoba12 commented 13 hours ago

@DiegoRodasRodriguez, that problem comes and goes due to changes in some Jupyter packages (yes, we use the same execution architecture as Jupyter).

Please open the Anaconda Prompt and run these commands there:

conda create -n spyder-env -c conda-forge spyder=5.5.6 matplotlib=3.8
conda activate spyder-env
spyder

That Spyder version should work as expected.