Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spyder's help and code completion features stop working after resuming from extended sleep #5613

Closed
trianta2 opened this issue Oct 30, 2017 · 36 comments

Comments

@trianta2
Copy link

Description of your problem

I've been experiencing this problem with Spyder for several months (maybe even years) on OSX, across multiple different machines. Currently I'm using macOS Sierra 10.12.6.

If I sleep my mac for an extended period of time with Spyder open, the help (CMD+i) and code completion features in the editor will stop working, however from within the iPython console they will continue to work.

This is difficult to reproduce, but eventually always happens. A short sleep will not cause the problem, nor will a sleep long enough to prompt a re-login.

What steps will reproduce the problem?

  1. Open Spyder
  2. Sleep mac for some unknown number of hours

What is the expected output? What do you see instead?
Help and code completion features in the Spyder editor are disabled.

Please provide any additional information below

Versions and main components

  • Spyder Version: 3.2.3
  • Python Version: Python 3.4.5 (but I've experienced this for multiple versions from 2.7-3.6)
  • Qt Version: 5.6.2
  • PyQt Version: 5.6
  • Operating system: macOS Sierra 10.12.6

Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:

IPython >=4.0 : 6.2.1 (OK)
cython >=0.21 : None (NOK)
jedi >=0.9.0 : 0.11.0 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.11.3 (OK)
pandas >=0.13.1 : 0.19.2 (OK)
psutil >=0.3 : 5.3.1 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.7 (OK)
sphinx >=0.6.6 : 1.6.4 (OK)
sympy >=0.7.3 : None (NOK)

@ccordoba12
Copy link
Member

ccordoba12 commented Oct 30, 2017

Thanks for reporting. This will (probably) be solved when we merge a new architecture to provide code completions and help, which is being worked out in PR #4751.

However, that work will be part of Spyder 4, to be released next year. There's nothing we can do for Spyder 3 though.

@trianta2
Copy link
Author

Thanks for the update. Looking forward to Spyder 4!

@CAM-Gerlach
Copy link
Member

For reference, I believe I am experiencing the same problem after sleep on Windows 10 Enterprise x64 with 3.2.3 - 3.2.4; as I put the machine to sleep in the middle of spyder sessions, and later come back (often much later) and completion, help etc. often mysteriously has stoped working in the editor but not the console. Therefore, it appears to be a cross platform issue.

@CAMGerlach-Baron
Copy link

Also, I can confirm this also happens anytime I lock my screen, i.e. as I'm supposed to whenever I step away from my machine, which essentially means I need to restart spyder every time I do so or miss out on help, completion, introspection, etc....obviously, a pretty large hit to productivity.

So, to confirm, there isn't any easy-ish way to patch/mitigate this bug without completely reworking the whole completion/introspection architecture—it isn't just some timeout or something somewhere? If not, is there anything short of a full Spyder close and relaunch that would serve to get it working again? If so, maybe we could implement an internal console command or GUI button somewhere to restart jedi/rope/whatever is breaking to fix it? Seems a hackish mitigation, but the alternatives are either a full close/restart cycle every time one leaves their machine for a few moments, or living with a large chunk of Spyder's functionality being disabled much of the time...

@ccordoba12
Copy link
Member

I can't reproduce it on Linux, so I don't know how to fix it. You can start Spyder with debug facilities turned on by running

set SPYDER_DEBUG "3"

and then starting Spyder from the command line to better understand what happens.

@CAMGerlach-Baron
Copy link

Okay, thanks much. I'll try to take a look a little later this week after I work on the FAQ, etc.

@ccordoba12
Copy link
Member

This should be fixed by our new code completion architecture.

@trianta2
Copy link
Author

@ccordoba12 is this new architecture in a current release? If so I can update and report if the issue is gone.

@ccordoba12
Copy link
Member

@trianta2, it'll be part of Spyder 4 and it'll be part of our beta2 version, to be released in a couple of weeks.

If you don't want to install our beta, you'll have to wait until January for the final version. In any case, you're welcome to report back.

@ccordoba12 ccordoba12 reopened this Oct 11, 2018
@ccordoba12 ccordoba12 added this to the Not sorted milestone Oct 11, 2018
@CAM-Gerlach
Copy link
Member

@trianta2 You can also test it now by cloning this Github repo, making an Anaconda environment with the right dependencies (in the requirements/requirements.txt file) and running python bootstrap.py in the main directory. However, do note it isn't fully stable yet and there are some kinks still to be worked out with the brand new architecture before we release it.

@venkatgmrit05
Copy link

this is still happening with spyder 3.3.1 on windows 7

@CAM-Gerlach CAM-Gerlach modified the milestones: not sorted, v4.0beta2 Dec 6, 2018
@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Dec 6, 2018

@venkatgmrit05 Please read @ccordoba12 's comment right above yours. As a quick update, we've delayed the release of Beta 2 to December to conduct additional testing on various OSes to make sure the new architecture is indeed much more stable and doesn't have these issues. Of course, we'd welcome your help in testing it once it is released, so we can iron out any remaining issues. Thanks.

@venkatgmrit05
Copy link

@venkatgmrit05 Please read @ccordoba12 's comment right above yours. As a quick update, we've delayed the release of Beta 2 to December to conduct additional testing on various OSes to make sure the new architecture is indeed much more stable and doesn't have these issues. Of course, we'd welcome your help in testing it once it is released, so we can iron out any remaining issues. Thanks.

gotcha! thank you,. looking forward to it :)

@ccordoba12 ccordoba12 modified the milestones: v4.0beta2, v4.0beta3 Dec 6, 2018
@ccordoba12 ccordoba12 modified the milestones: v4.0beta3, v4.0beta4 May 18, 2019
@ccordoba12 ccordoba12 removed this from the v4.0betaX milestone Jun 17, 2019
@ccordoba12 ccordoba12 modified the milestone: v4.0beta4 Jun 17, 2019
@mxardre
Copy link

mxardre commented Sep 22, 2019

I am also having this problem macos 10.14.6. Spyder opened through anaconda. Any solution so far?
Best

@ccordoba12
Copy link
Member

This is probably going to be fixed in Spyder 4, to be released in a month or so.

@mxardre
Copy link

mxardre commented Sep 22, 2019

Thanks!

@CAM-Gerlach
Copy link
Member

@mxardre As @ccordoba12 said, this has mostly been fixed in Spyder 4, of which 7 betas have already been released and the next release AFAIK should be the release candidate build, the final stage before a release. You can try out the betas now to see if it resolves the issue, and track the real-time progress of the release with the 4.0rc and the 4.0.0 final milestones.

@Travis-Barton
Copy link

So when will this be patched in the non-beta spyder? This is a rather small, but very inconvenient bug.

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Nov 5, 2019

@Travis-Barton It already is as of a few days ago, as Spyder 4.0.0rc1 has been released, which is labelled a release candidate rather than a beta (as a clarification, what the Spyder team has referred to as betas are usually termed alphas since they add major features, and the release candidate is what would more typically be called a final beta since a followup final release was always planned, but to be clear that is not a negative judgement on their quality/stability and I've used the betas as my daily driver for the past year since Spyder 4 beta 2 and they are relatively stable now).

Spyder 4.0.0 final should be out very soon; you can track the progress toward the same in by following the relevant milestone on Github.

@Travis-Barton
Copy link

@Travis-Barton It already is as of a few days ago, as Spyder 4.0.0rc1 has been released, which is labelled a release candidate rather than a beta (as a clarification, what the Spyder team has referred to as betas are usually termed alphas since they add major features, and the release candidate is what would more typically be called a final beta since a followup final release was always planned, but to be clear that is not a negative judgement on their quality/stability and I've used the betas as my daily driver for the past year since Spyder 4 beta 2 and they are relatively stable now).

Spyder 4.0.0 final should be out very soon; you can track the progress toward the same in by following the relevant milestone on Github.

Taking a look at the release notes I see several quality of life features that I am exited about! I can't wait to start using it!

@JonB451
Copy link

JonB451 commented May 19, 2020

In case this is not understood yet and new anecdotal observations add to the clues:

I seem to have this problem (autocomplete stops working, in Editor but not IPython, after putting Win10 to sleep)
with Spyder 4.1.3
but not with 4.1.2.

To confirm, after Win10 sleep:
Spyder 4.1.2 Autocomplete as expected.
Spyder 4.1.3 Autocomplete not operating in Editor.

Please let me know if more details would help.

@CAM-Gerlach
Copy link
Member

Thanks for the detailed information! Its quite likely a different issue since the completion infrastructure is almost completely redone from what was there before, particularly the parts that OS sleep is likely to affect. However, that's a potentially very interesting result, if a Spyder change really did prompt completion to stop working in this scenario.

However, I was not able to reproduce this behavior on either my clean Win 10 1909 test box running Spyder 4.1.3, with clean prefs and a clean slate of the latest Spyder dependencies installed (most notably Spyder-Kernels 1.9.1, Jedi 0.15.2, Python-Language-Server 0.31.10, Rope 0.17.0, Parso 0.5.2, nor on either Spyder 4.1.2 or Spyder 4.1.3 on my primary Win 8.1 machine under the same deps, both under Python 3.7. In all cases, after short or long (multi-minute) sleep, completion, help and other LSP services worked from the Editor as expected.

If you can provide a complete conda list output for the environment in which you were running Spyder, as well as any information you have (e.g. conda install or conda update output) on any other dependencies that changed between one version and the other, that would be very helpful. Furthermore, can you reproduce this behavior in a fresh, clean environment installing Spyder 4.1.3? Thanks!

@mrclary
Copy link
Contributor

mrclary commented May 20, 2020

I wonder if there is any relation to #12259. Currently, Jedi 0.15.2 does not use a clean environment when launched, and while this may only affect non-conda environments, I'm curious to know whether system variables are changed over some period of time by the system, then, if the LSP (and Jedi) are ever restarted (as can happen normally) an offending variable is picked up by Jedi causing unstable behavior. Just an outlandish theory...

@JonB451
Copy link

JonB451 commented May 20, 2020

@CAM-Gerlach Sorry i also have this issue now on 4.1.2 after sleeping Win10.1809 overnight (multi-hour). ctrl+I seems to stop working at the same time, but not 100% sure yet. Will confirm.

Both Spyder installs (4.1.2 and 4.1.3) are from Anaconda 1.9.12, Conda 4.8.3. No Pip use at all on these envs.
Linking to other envs otherwise well via spyder-kernels 1.9.1
Python 3.7.7
jedi 0.15.2
rope 0.17.0
parso 0.5.2
python-language-server 0.31.10
pyqt 5.9.2
ipython 7.13.0

Full conda list (the only diff is spyder 4.1.2 and 4.1.3, ie all other packages identical versions):

alabaster 0.7.12 py37_0
argh 0.26.2 py37_0
astroid 2.4.0 py37_0
atomicwrites 1.4.0 py_0
attrs 19.3.0 py_0
autopep8 1.4.4 py_0
babel 2.8.0 py_0
backcall 0.1.0 py37_0
bcrypt 3.1.7 py37he774522_0
blas 1.0 mkl
bleach 3.1.4 py_0
ca-certificates 2020.1.1 0
certifi 2020.4.5.1 py37_0
cffi 1.14.0 py37h7a1dbc1_0
chardet 3.0.4 py37_1003
cloudpickle 1.4.1 py_0
colorama 0.4.3 py_0
cryptography 2.9.2 py37h7a1dbc1_0
decorator 4.4.2 py_0
defusedxml 0.6.0 py_0
diff-match-patch 20181111 py_0
docutils 0.16 py37_0
entrypoints 0.3 py37_0
flake8 3.7.9 py37_0
future 0.18.2 py37_0
icc_rt 2019.0.0 h0cc432a_1
icu 58.2 ha925a31_3
idna 2.9 py_1
imagesize 1.2.0 py_0
importlib_metadata 1.5.0 py37_0
intel-openmp 2020.1 216
intervaltree 3.0.2 py_0
ipykernel 5.1.4 py37h39e3cac_0
ipython 7.13.0 py37h5ca1d4c_0
ipython_genutils 0.2.0 py37_0
isort 4.3.21 py37_0
jedi 0.15.2 py37_0
jinja2 2.11.2 py_0
jpeg 9b hb83a4c4_2
jsonschema 3.2.0 py37_0
jupyter_client 6.1.3 py_0
jupyter_core 4.6.3 py37_0
keyring 21.1.1 py37_2
lazy-object-proxy 1.4.3 py37he774522_0
libpng 1.6.37 h2a8f88b_0
libsodium 1.0.16 h9d3ae62_0
libspatialindex 1.9.3 h33f27b4_0
markupsafe 1.1.1 py37he774522_0
mccabe 0.6.1 py37_1
mistune 0.8.4 py37he774522_0
mkl 2020.1 216
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.15 py37h14836fe_0
mkl_random 1.1.0 py37h675688f_0
nbconvert 5.6.1 py37_0
nbformat 5.0.6 py_0
numpy 1.18.1 py37h93ca92e_0
numpy-base 1.18.1 py37hc3f5095_1
numpydoc 0.9.2 py_0
openssl 1.1.1g he774522_0
packaging 20.3 py_0
pandas 1.0.3 py37h47e9c7a_0
pandoc 2.2.3.2 0
pandocfilters 1.4.2 py37_1
paramiko 2.7.1 py_0
parso 0.5.2 py_0
pathtools 0.1.2 py_1
pexpect 4.8.0 py37_0
pickleshare 0.7.5 py37_0
pip 20.0.2 py37_3
pluggy 0.13.1 py37_0
prompt-toolkit 3.0.4 py_0
prompt_toolkit 3.0.4 0
psutil 5.7.0 py37he774522_0
pycodestyle 2.5.0 py37_0
pycparser 2.20 py_0
pydocstyle 4.0.1 py_0
pyflakes 2.1.1 py37_0
pygments 2.6.1 py_0
pylint 2.5.0 py37_1
pynacl 1.3.0 py37h62dcd97_0
pyopenssl 19.1.0 py37_0
pyparsing 2.4.7 py_0
pyqt 5.9.2 py37h6538335_2
pyrsistent 0.16.0 py37he774522_0
pysocks 1.7.1 py37_0
python 3.7.7 h81c818b_4
python-dateutil 2.8.1 py_0
python-jsonrpc-server 0.3.4 py_0
python-language-server 0.31.10 py37_0
pytz 2020.1 py_0
pywin32 227 py37he774522_1
pywin32-ctypes 0.2.0 py37_1000
pyyaml 5.3.1 py37he774522_0
pyzmq 18.1.1 py37ha925a31_0
qdarkstyle 2.8.1 py_0
qt 5.9.7 vc14h73c81de_0
qtawesome 0.7.0 py_0
qtconsole 4.7.3 py_0
qtpy 1.9.0 py_0
requests 2.23.0 py37_0
rope 0.17.0 py_0
rtree 0.9.4 py37h21ff451_1
setuptools 46.2.0 py37_0
sip 4.19.8 py37h6538335_0
six 1.14.0 py37_0
snowballstemmer 2.0.0 py_0
sortedcontainers 2.1.0 py37_0
sphinx 3.0.3 py_0
sphinxcontrib-applehelp 1.0.2 py_0
sphinxcontrib-devhelp 1.0.2 py_0
sphinxcontrib-htmlhelp 1.0.3 py_0
sphinxcontrib-jsmath 1.0.1 py_0
sphinxcontrib-qthelp 1.0.3 py_0
sphinxcontrib-serializinghtml 1.1.4 py_0
spyder 4.1.2 py37_0
spyder-kernels 1.9.1 py37_0
sqlite 3.31.1 h2a8f88b_1
testpath 0.4.4 py_0
toml 0.10.0 py37h28b3542_0
tornado 6.0.4 py37he774522_1
traitlets 4.3.3 py37_0
typed-ast 1.4.1 py37he774522_0
ujson 1.35 py37hfa6e2cd_0
urllib3 1.25.8 py37_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
watchdog 0.10.2 py37_0
wcwidth 0.1.9 py_0
webencodings 0.5.1 py37_1
wheel 0.34.2 py37_0
win_inet_pton 1.1.0 py37_0
wincertstore 0.2 py37_0
wrapt 1.11.2 py37he774522_0
yaml 0.1.7 hc54c509_2
yapf 0.28.0 py_0
zeromq 4.3.1 h33f27b4_3
zipp 3.1.0 py_0
zlib 1.2.11 h62dcd97_4

@ccordoba12
Copy link
Member

@JonB451, could you apply the patch in #12771 to your installation and try again?

@JonB451
Copy link

JonB451 commented May 20, 2020

@ccordoba12 I'm not a coder by trade so i'm not sure of the normal way to do that. My hack is to just edit that file with that one line of code change. I've done that and restarted Spyder fine. Will have to get back to you when Win has been in a long sleep, probably <24 hours. Hope that's ok.

@ccordoba12
Copy link
Member

My hack is to just edit that file with that one line of code change

That's fine.

Will have to get back to you when Win has been in a long sleep, probably <24 hours. Hope that's ok.

Ok, thanks for your help!

@JonB451
Copy link

JonB451 commented May 21, 2020

@ccordoba12 After patch #12771 then first long sleep: All good (Editor completion and ctrl+I).
Next update in about 48 hours or if problem before then.

@JonB451
Copy link

JonB451 commented May 21, 2020

@ccordoba12 About an hour later, without an OS sleep, completion has stopped working.

I cannot be exactly sure when that was triggered but at the same time i noticed another problem which i had not before. I added one line near the top of the code so all the functions were pushed down one line. The little triangles next to the line numbers which allow you to collapse (fold?) a function did not move with the function and were still trying to operate on the now empty lines. Is this related to Linter?

@mrclary
Copy link
Contributor

mrclary commented May 21, 2020

@JonB451 , does restarting the LSP server from the statusbar return proper functionality?

@ccordoba12
Copy link
Member

About an hour later, without an OS sleep, completion has stopped working.

Sorry to hear that. It was confirmed by another user (and me), that #12771 fixes this problem on Windows, so I don't know what else could be happening.

The little triangles next to the line numbers which allow you to collapse (fold?) a function did not move with the function and were still trying to operate on the now empty lines. Is this related to Linter?

Yeah, linting and folding depend on the same server, so if one dies, the other dies too.

@CAM-Gerlach
Copy link
Member

I would guess that whatever followup issue issue @JonB451 just reported is not directly related to this one, then, given that the behavior is different?

@JonB451
Copy link

JonB451 commented May 22, 2020

@mrclary Yes it does! Thanks.
@trianta2 Does that resolve your issue too?

Update after almost a week of using daily: restarting the LSP server from the statusbar is such an acceptable workaround that i'm no longer bothered that the problem is there at all.

@quamobrem
Copy link

@JonB451 That would also be a more than acceptable workaround. Could you explain to me how to restart the LSP server from the status bar? Does this require Kite to be installed? Thanks.

@JonB451
Copy link

JonB451 commented Jul 14, 2020

Hi @quamobrem I don't have Kite installed. In the status bar at the bottom of Spyder, amongst other statuses, is the "LSP Python" status. If you click on it then a pop up gives you the option to "Restart Python Language Server". That's it :-) Hope it works for you.

@ccordoba12
Copy link
Member

Closing because a problem like this hasn't been reported in a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants