spyder-ide / spyder

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

Code completion and linting stop working during the current session #11026

Closed Khris777 closed 4 years ago

Khris777 commented 4 years ago

After working for a while in Spyder at some point several functions just stop working:

Often there is no error message, sometimes there is one that tells me that code completion and linting will not work in the current session or have stopped working. It tells me to make sure that my firewall or antivirus allow Python processes to open ports on my system or to restart Spyder.

I'm working at a company behind a company firewall with an Antivirus Software.

My question is now:

  1. Why is it able to work for like 10 minutes before suddenly stopping? Apparently the local Python Language Server is working normally, so why does it suddenly stop?
  2. Can this be solved using the Proxy-Settings in the preferences?

EDIT 1: I played around with the advanced settings. In the end I enabled the usage of STDIO-Pipes and started Spyder with that option enabled. Performance was worse and the error also happened after a while, so I switched the option off and continued working. Apparently this restarted the language server and since then (about an hour ago) it has been running without fail. This makes it look more like the issue is not with my system's firewall or antivirus but some internal Spyder issue, maybe something that happens at startup?

EDIT 2: After about 4 hours the error happend again. I did what I did above, go into the settings, activate STDIO-Pipes, then deactivate it again, now the server is running again normally.

Versions

Dependencies

cloudpickle >=0.5.0          :  1.2.2 (OK)
pygments >=2.0               :  2.5.2 (OK)
qtconsole >=4.6.0            :  4.6.0 (OK)
nbconvert >=4.0              :  5.6.1 (OK)
sphinx >=0.6.6               :  2.2.2 (OK)
pylint >=0.25                :  2.4.4 (OK)
psutil >=0.3                 :  5.6.7 (OK)
qtawesome >=0.5.7            :  0.6.0 (OK)
qtpy >=1.5.0                 :  1.9.0 (OK)
pickleshare >=0.4            :  0.7.5 (OK)
zmq >=17                     :  18.1.1 (OK)
chardet >=2.0.0              :  3.0.4 (OK)
numpydoc >=0.6.0             :  0.9.1 (OK)
spyder_kernels >=1.8.1;<2.0.0:  1.8.1 (OK)
qdarkstyle >=2.7             :  2.7 (OK)
atomicwrites >=1.2.0         :  1.3.0 (OK)
diff_match_patch >=20181111  :  20181111 (OK)
intervaltree                 :  None (OK)
watchdog                     :  None (OK)
keyring                      :  None (OK)
pexpect >=4.4.0              :  4.7.0 (OK)
pympler                      :  None (OK)
sympy >=0.7.3                :  1.4 (OK)
cython >=0.21                :  0.29.14 (OK)
IPython >=4.0                :  7.10.1 (OK)
matplotlib >=2.0.0           :  3.1.2 (OK)
pandas >=0.13.1              :  0.25.3 (OK)
numpy >=1.7                  :  1.17.3 (OK)
scipy >=0.17.0               :  1.3.1 (OK)
pyls >=0.31.2;<0.32.0        :  0.31.2 (OK)
rtree >=0.8.3                :  0.9.1 (OK)
JoElfner commented 4 years ago

While those features may help, they seem to be only remedial to recover from the aftermath of the error

Hopefully things will go unnoticed from now on when the server stops working for most users, because it'll be restarted by Spyder automatically.

Do you have any idea yet why it happens in the first place?

We're still investigating the issue.

Thanks for doing this. As a user though I do feel Spyder is getting quite slow and slightly delayed to work with, even with just typing code for example. Responsiveness in the program is really important and these kind of constant checks and workarounds can impact reliability of the program. Though I love Spyder, I am seriously close to changing IDE's as a result of the constant interruptions with this error, crashes and instability. Hope a true fix rather than workaround can be found? Even getting a dialog every 20 minutes is extremely annoying when you are trying to focus. At least the variable memory will not be erased due to program crash. Happy to help with anything. Cheers Peter

Same here. It was really nice to work with Spyder 2 and 3. Features might not have been complete and/or perfect, but Spyder was working nicely without crashing and/or slowing down. Code completition was not really functional at that time, but honestly: If you are used to coding, code completition will save you only a small amount of time (compared to the cost of slow-downs or crashes).

Starting with version 4 (or perhaps already somewhere at version 3), with each new version Spyder started to introduce more bugs than features. Imho the focus should for now should be on fixing all the bugs introduced by new (highly optional) features like Kite etc... Over the last year in my workplace Spyder "acquired" a set of nicknames, of which "Cryder" (Crashy-Spyder) is one of the most favorable. Spyder went from being the most used Python IDE to a share of about 10%. PyCharm (and some others) have taken over. Unluckily I also had to move to PyCharm yesterday, since no changes seem to happen on this critical issues and otherwise my timeschedule would break my neck...

So imho to discourage people from changing to other IDEs, fixing bugs should be top priority over new features or improving features. And this also includes bug-handling procedures. F.i. the PR on this absolutely critical bug is marked as merged since almost 5 days, but no release has been made. But isn't fixing a critical bug the best reason ever to push an intermediate release, disregarding all planned PRs for the next release cycle?

pbower commented 4 years ago

While those features may help, they seem to be only remedial to recover from the aftermath of the error

Hopefully things will go unnoticed from now on when the server stops working for most users, because it'll be restarted by Spyder automatically.

Do you have any idea yet why it happens in the first place?

We're still investigating the issue.

Thanks for doing this. As a user though I do feel Spyder is getting quite slow and slightly delayed to work with, even with just typing code for example. Responsiveness in the program is really important and these kind of constant checks and workarounds can impact reliability of the program. Though I love Spyder, I am seriously close to changing IDE's as a result of the constant interruptions with this error, crashes and instability. Hope a true fix rather than workaround can be found? Even getting a dialog every 20 minutes is extremely annoying when you are trying to focus. At least the variable memory will not be erased due to program crash. Happy to help with anything. Cheers Peter

Same here. It was really nice to work with Spyder 2 and 3. Features might not have been complete and/or perfect, but Spyder was working nicely without crashing and/or slowing down. Code completition was not really functional at that time, but honestly: If you are used to coding, code completition will save you only a small amount of time (compared to the cost of slow-downs or crashes).

Starting with version 4 (or perhaps already somewhere at version 3), with each new version Spyder started to introduce more bugs than features. Imho the focus should for now should be on fixing all the bugs introduced by new (highly optional) features like Kite etc... Over the last year in my workplace Spyder "acquired" a set of nicknames, of which "Cryder" (Crashy-Spyder) is one of the most favorable. Spyder went from being the most used Python IDE to a share of about 10%. PyCharm (and some others) have taken over. Unluckily I also had to move to PyCharm yesterday, since no changes seem to happen on this critical issues and otherwise my timeschedule would break my neck...

So imho to discourage people from changing to other IDEs, fixing bugs should be top priority over new features or improving features. And this also includes bug-handling procedures. F.i. the PR on this absolutely critical bug is marked as merged since almost 5 days, but no release has been made. But isn't fixing a critical bug the best reason ever to push an intermediate release, disregarding all planned PRs for the next release cycle?

Agree 100%.

Has this issue been opened as a separate issue to fully investigate and fix, or is the hacky dialog box really closing the issue?

pbower commented 4 years ago

To those interested in our solution, we've done the following to improve this annoying situation:

  • Add an option to never show the intrusive message again. Selección_004
  • Add a mechanism that tries to detect if the server went down and tries to automatically restart it.
  • Add a new entry to the status bar that shows the status of the server (starting, ready, restarting or down) and a menu entry that allows to restart it manually: imagen

How to get that option?

Ok thanks - it’s good the box can be disabled. At the moment, when one types even a single key (In the Non fixed version) the error message box comes up again and again. in the fix, if one disabled the box, can we be sure the program will not be constantly polling the external service? Cheers

pbower commented 4 years ago

It's also worth noting that this error often occurs when one holds down backspace or deletes a lot of information in quick succession.

rgommers commented 4 years ago

Same here. It was really nice to work with Spyder 2 and 3. ...

Starting with version 4 (or perhaps already somewhere at version 3), with each new version Spyder started to introduce more bugs than features. Imho the focus should for now should be on fixing all the bugs introduced by new (highly optional) features like Kite etc...

Please note that there were a lot of users wanting improved code completion and other new features. The Spyder 4 release was a massive overhaul of the code base. When you do such a large release with a relatively small team, naturally bugs will creep in. The Spyder team has worked very hard over the past couple of months on bug fixing to stabilize the 4.x series. 4.1.2 was tagged yesterday, and is now a PR on conda-forge that passes all CI - so should be available shortly.

Over the last year in my workplace Spyder "acquired" a set of nicknames, of which "Cryder" (Crashy-Spyder) is one of the most favorable. Spyder went from being the most used Python IDE to a share of about 10%. PyCharm (and some others) have taken over. Unluckily I also had to move to PyCharm yesterday, since no changes seem to happen on this critical issues and otherwise my timeschedule would break my neck...

So imho to discourage people from changing to other IDEs, fixing bugs should be top priority over new features or improving features. And this also includes bug-handling procedures. F.i. the PR on this absolutely critical bug is marked as merged since almost 5 days, but no release has been made. But isn't fixing a critical bug the best reason ever to push an intermediate release, disregarding all planned PRs for the next release cycle?

@JoElfner honestly, I don't think you understand what it takes to do a release of a package like Spyder. Speaking from experience as NumPy and SciPy release manager: it easily takes 1-2 days, and Spyder has a much more complex set of dependencies than NumPy/SciPy. @ccordoba12 and his team are working on this as hard as they can.

Please understand that comments like yours can be very demotivating, and are not really helpful. Community open source projects rely on a small number of maintainers, most of which are working very hard next to a day job or degree. If you want to help, please keep bug reports and comments constructive at a minimum. Contributing fixes or documentation, or donating (https://opencollective.com/spyder - $6500 yearly budget currently) would also be great to consider.

rgommers commented 4 years ago

Agree 100%.

Please see my comment above @pbower

Has this issue been opened as a separate issue to fully investigate and fix, or is the hacky dialog box really closing the issue?

As @ccordoba12 said, the team is still investigating. The crashes are not in Spyder itself, so the current set of fixes (not just the dialog box, also auto-restarting) plus helping improve upstream projects seems like the right approach.

pbower commented 4 years ago

Agree 100%.

Please see my comment above @pbower

Has this issue been opened as a separate issue to fully investigate and fix, or is the hacky dialog box really closing the issue?

As @ccordoba12 said, the team is still investigating. The crashes are not in Spyder itself, so the current set of fixes (not just the dialog box, also auto-restarting) plus helping improve upstream projects seems like the right approach.

Thanks, appreciate your comments and the hard work from the team. The issue caused my spyder instance to crash 20-30 times in the last 3 days for a project, so good that it’s being investigated and fixed. I would love help out any way possible, I’m probably not experienced enough yet though. You guys should be proud of the work that’s been done - the plotting stuff it does is brilliant now. Cheers

ccordoba12 commented 4 years ago

I would love help out any way possible, I’m probably not experienced enough yet though.

Thanks for your offer @pbower. What we need is a simple, reproducible use case that generates this kind of errors, so we can debug them in our side.

So if you could give us a small, self-contained sample of your code that does that, we'd be really grateful.

You guys should be proud of the work that’s been done - the plotting stuff it does is brilliant now.

Thanks for your kind words @pbower!

ghost commented 4 years ago

Looking forward to all your efforts resolving this :)

pbower commented 4 years ago

I would love help out any way possible, I’m probably not experienced enough yet though.

Thanks for your offer @pbower. What we need is a simple, reproducible use case that generates this kind of errors, so we can debug them in our side.

So if you could give us a small, self-contained sample of your code that does that, we'd be really grateful.

You guys should be proud of the work that’s been done - the plotting stuff it does is brilliant now.

Thanks for your kind words @pbower!

Thanks for that.

To replicate this error, I suggest the following:

  1. Ensure user has no local admin rights, or network rights.
  2. Type (do your coding) fast, or hold down backspace. It appears to overload the code completion tool and cause the error.

Alternatively, code for 20-30 minutes and it will appear, crashing the program.

Python 3.7.6 | Qt 5.12.5 | PyQt 5.12.3 | Windows 10

Cheers Peter

JoElfner commented 4 years ago

Same here. It was really nice to work with Spyder 2 and 3. ... Starting with version 4 (or perhaps already somewhere at version 3), with each new version Spyder started to introduce more bugs than features. Imho the focus should for now should be on fixing all the bugs introduced by new (highly optional) features like Kite etc...

Please note that there were a lot of users wanting improved code completion and other new features. The Spyder 4 release was a massive overhaul of the code base. When you do such a large release with a relatively small team, naturally bugs will creep in. The Spyder team has worked very hard over the past couple of months on bug fixing to stabilize the 4.x series. 4.1.2 was tagged yesterday, and is now a PR on conda-forge that passes all CI - so should be available shortly.

Yep, I've taken note of it. I'm not saying that these features should not have been integrated, I'm just saying that a step-by-step integration could have been helpful with avoiding to introduce bugs. F.i. imho either ramping up the internal code completition feature or integrating things like Kite (which for example also doesn't work correctly on my machines). But not both at the same time.

Over the last year in my workplace Spyder "acquired" a set of nicknames, of which "Cryder" (Crashy-Spyder) is one of the most favorable. Spyder went from being the most used Python IDE to a share of about 10%. PyCharm (and some others) have taken over. Unluckily I also had to move to PyCharm yesterday, since no changes seem to happen on this critical issues and otherwise my timeschedule would break my neck... So imho to discourage people from changing to other IDEs, fixing bugs should be top priority over new features or improving features. And this also includes bug-handling procedures. F.i. the PR on this absolutely critical bug is marked as merged since almost 5 days, but no release has been made. But isn't fixing a critical bug the best reason ever to push an intermediate release, disregarding all planned PRs for the next release cycle?

@JoElfner honestly, I don't think you understand what it takes to do a release of a package like Spyder. Speaking from experience as NumPy and SciPy release manager: it easily takes 1-2 days, and Spyder has a much more complex set of dependencies than NumPy/SciPy. @ccordoba12 and his team are working on this as hard as they can.

Please understand that comments like yours can be very demotivating, and are not really helpful. Community open source projects rely on a small number of maintainers, most of which are working very hard next to a day job or degree. If you want to help, please keep bug reports and comments constructive at a minimum. Contributing fixes or documentation, or donating (https://opencollective.com/spyder - $6500 yearly budget currently) would also be great to consider.

True and sorry for that! I have to admit that I only contributed to and/or released internal/private packages of smaller size than Spyder etc, thus I am short on experience with large packages.

My criticism does not mean that I do not ackowledge the work of the Spyder team. If I wasn't appreciating the work, I wouldn't even care to write a comment here. In contrast: I really ackowledge the hard and great work and want to thank the team for it. I just thought that some first-hand information/user-experience pointing out some (non-coding-)issues from the user-side might be helpful. Perhaps my words were a bit harsh and/or demotivating, but I personally prefer getting direct feedback over users silently migrating to other tools.

ChemicalSailor commented 4 years ago

Thanks for your offer @pbower. What we need is a simple, reproducible use case that generates this kind of errors, so we can debug them in our side.

I've only experienced these faults on a Win10 installation with Spyder installed in it's own environment. In MacOS I've not had a problem.

Anecdotally, I'd say the error arises when modifying code quickly. It doesn't necessarily matter how long the code is, or how long the program has been open. Is running Spyder in debug mode likely to prove fruitful?

mariosgeo commented 4 years ago

Hi I have the same problem. It seems that happens randomly. I have to say that after waiting for version 4.1, that fixed the freezing bug, now we have this. The joy of open source software is here :)

I propose professional users should switch to another environment for the times been.

rgommers commented 4 years ago

Hi I have the same problem. It seems that happens randomly.

Both conda-forge and PyPI have 4.1.2 since 2 days; can you please try if this still happens with that version?

pbower commented 4 years ago

Hi I have the same problem. It seems that happens randomly.

Both conda-forge and PyPI have 4.1.2 since 2 days; can you please try if this still happens with that version?

Ok yes I will try today.

pbower commented 4 years ago

Hi, Please re-open this issue request for 4.1.2 I have been testing today and though the dialog box disappears, once it has occurred once the program constantly freezes for 3-5 seconds until it is shut down and restarted.

Usually, after re-establishing the connection in the background, this continues frequently.

Thanks

pbower commented 4 years ago

Hi I have the same problem. It seems that happens randomly.

Both conda-forge and PyPI have 4.1.2 since 2 days; can you please try if this still happens with that version?

Hi, Also in addition to comments above, I should add that the temporary fix is still an improvement to the original, as one does not lose their variables / work and there is an opportunity to save/pickle them before restart. Regards, Peter

ccordoba12 commented 4 years ago

@pbower, please open a new issue about the new problem.

BartBeemsterboer commented 4 years ago

I just upgraded Spyder and so far it seems to be working well. At some point I realised something was going on in the backend as my editor was very slow to react. This took about 5 seconds. It was triggered by moving through commented text in the editor by keyboard arrows, which has previously triggered the endless error popups. So I suspect this was the server restart referred to above. After 5 seconds I was able to continue working normally.

Thank you very much!

Hagbeard commented 4 years ago

Updated Spyder and it's still occurring, usually after an hour or two of work.

ccordoba12 commented 4 years ago

@Hagbeard, you can restart the server manually if that occurs. That's all we can do at the moment.

Hagbeard commented 4 years ago

Thanks @ccordoba12, I find killing Spyder to be most effective because the notifications come in such quick succession that even getting a ctrl+s in before the next notification can be hard.

ccordoba12 commented 4 years ago

I find killing Spyder to be most effective because the notifications come in such quick succession that even getting a ctrl+s in before the next notification can be hard.

That was in 4.1.1. We're talking about 4.1.2 (please read the last 10 or 15 messages for context).

Hagbeard commented 4 years ago

Roger that, sorry, had previously updated to 4.1.1. It's working better now on 4.1.2, it lags when I think it's going to crash, but doesn't result in the same message and is more stable.

ccordoba12 commented 4 years ago

Great to know @Hagbeard!

shllybkwrm commented 4 years ago

I have just updated to Spyder 4.1.4 via conda (I also tried conda remove and then reinstalling). I never saw the popup about code completion and linting before, but now I get it constantly within a minute or two of launching Spyder. As the error doesn't seem to be fixed for me, anything else I should try?

ccordoba12 commented 4 years ago

@shllybkwrm, you probably have installation issues. Please open a new issue about your problem, so we can take a look at them.

shllybkwrm commented 4 years ago

Will do. In the meantime I rolled back to 4.1.3 (following a recommendation earlier in the thread, ) and the popup has gone away as far as I can tell.

arora123 commented 3 years ago

"please start Spyder from the Anaconda Prompt or a terminal with the following command

spyder --debug-info verbose --debug-output file

let it run until the dialog appears and upload the file called spyder-debug.log (saved in the directory where you started Spyder)"

From an answer by Spyder Maintainer: https://stackoverflow.com/a/60839390/5114585

jansonleeljs commented 3 years ago

I confront this trouble today and find that there is another way to solve it.

Background. I just install spyder 5.0.5 with my python 3.7 (win10 and through pip install spyder). The spyder works pretty well except that the python language server is down and the auto-completion does not work. I've tried methods like installing parso in the correct version and delete *.pyc files, but they don't work for me. Solution. Replace the spyder 5.0.5 with spyder 4.2.5. Perhaps the problem is caused by incompatible issues.

I hope this method can help someone else.

AldoMaine commented 3 years ago

I confront this trouble today and find that there is another way to solve it.

Background. I just install spyder 5.0.5 with my python 3.7 (win10 and through pip install spyder). The spyder works pretty well except that the python language server is down and the auto-completion does not work. I've tried methods like installing parso in the correct version and delete *.pyc files, but they don't work for me. Solution. Replace the spyder 5.0.5 with spyder 4.2.5. Perhaps the problem is caused by incompatible issues.

I hope this method can help someone else.

Thanks @jansonleeljs , this not only fixed my language server issue with spyder 5.0.5 but also the lack of git integration.