Referring to https://stackoverflow.com/questions/59250636/how-to-turn-on-off-code-analysis-features-in-spyder-4
Some steps, most of them are probably rather irrelevant, but you never know.
1)
I had seen the new menu point for Completion and linting, it was also checked automatically after the standard update installation, but it did not work as expected. Everyone should have a working linting from the start as it is checked as a standard. But I did not have it. Now it worked for a moment, and 1 of 2 possible steps has probably led to this: I have restarted the computer, unfortunately I have not checked if this solved it. I have once unchecked the "Enable basic linting", pressed OK, and then checked it again afterwards.
2)
Another strange thing might have solved something for a while. Spyder once crashed when I had a hand as a cursor and in that moment, clicked on the left part where you set the breakpoints normally. After restart, I was asked to restore the code. Pressing yes, I saw red lines the first time, but they were totally wrong and everywhere in and around the code block I had just recently worked on. Saving this, and restarting, the red lines were gone. The linting did not appear, but this crash might still have triggered something. This crash is probably completely unimportant. It is rather unlikely to have solved anything, because, after the crash, linting still did not work.
3)
Now I have used the linting to add the needed passed parameters, but the linting has not disappeared, with error "Undefined Name '....' (pyflakes E), although that variable is a passed parameter to the function in which I use it. I do not know if this is still related to the question, but the linting does at least not work as it had before, I expected any underline to go away as soon as the variable is known in the function. Probably I have to change something in the pyflakes setup to refresh automatically?
4)
I have set linting - "Enable basic linting" and "Underline errors and warnings" of and on again, all of the red lines are gone, also where they still should be, and red x circles on the left show the same "undefined name …" error at positions where the parameter is definitely already known.
Please open a terminal (cmd.exe, Terminal.app or xterm), run the following command:
spyder --debug-info verbose --debug-output file
and upload here the file called spyder-debug.log
, which is created in the same directory where you ran the command above.
Also, how did you install Spyder? With Anaconda or pip?
When I run the command
spyder --debug-info verbose --debug-output file
I get 'spyder' is not recognized as an internal or external command, operable program or batch file.
I have installed it with Anaconda on Windows.
I used the anaconda prompt with code
conda update spyder
Now I have used
spyder --debug-info verbose --debug-output file
in anaconda prompt, and spyder opened. The linting suddenly works. I added a missing parameter, and the linting vanished as you would expect it. I do not know if this is now because of the debug opening or because I have restarted Spyder after some changes - and change-backs - in the Completion and linting menu. Anyway, now it works :)
Anyway, now it works :)
Ok, good to know.
spyder-debug - start only, no project details.log
Here is the start of the debug log that I was asked for yesterday. Unfortunately, this is already a log of a status where "Completion and linting" has suddenly worked. Perhaps this is still interesting for someone. I have now restarted Spyder without debug mode, and the completion and linting still works. If someone else has this problem, I recommend that you close Spyder with changes of the mentioned menu points from checked to unchecked, and then change the menu points back after restart. It might be a problem of refreshing.
Had same issue installing with Anaconda.
Using spyder --debug-info verbose --debug-output file
worked !
Thanks :)
I also have the same issue (linting not working). I had no problems with Spyder 3; this problem appeared after upgrading to Spyder 4 (which I did via conda update spyder
). Launching Spyder via spyder --debug-info verbose --debug-output file
from the Anaconda Prompt fixes the issue for me as well, although I haven't been able to get it to work when launching from the normal Windows shortcut.
Hello, having the same issue ; when trying the spyder --debug-info verbose --debug-output file
fix, I get this error:
spyder: error: no such option: --debug-info
I am launching spyder from the spyder3.exe
file of my virtualenv
, which I installed with pip
; I dont know if it's related
I have the same problem... is there any definite to this problem?
Thanks...
I am curious whether this issue is actually still open. There have been 2K views on https://stackoverflow.com/questions/59250636/how-to-turn-on-off-code-analysis-features-in-spyder-4/61958873#61958873
I cannot test it anymore as I have changed the IDE.
And spyder --debug-info verbose --debug-output file
is obviously just a workaround for the meantime, you do not want to start spyder always like this? If this issue was not fixed up to now, it should be opened again. Thank you.
We had a long time trying to figure out why code completion and linting were failing. However, I think we finally nailed the issue: it was a problem that only appeared on Windows and @OverLordGoldDragon was critical in providing us a reproducible use case with which I could finally fix it.
The fix will be available in our next version (4.1.4), to be released by the end of this week or early during the next one.
Hi ccordoba12, I have added a full copy of your recent comment as an answer of https://stackoverflow.com/questions/59250636/how-to-turn-on-off-code-analysis-features-in-spyder-4/62519212#62519212, I hope this is OK, please tell me elsewise. Or please add your own answer there, and I will delete mine again. Thank you.
Thanks @lorenzznerol! Leaving your own answer is fine for me, just don't forget to mark it as the right one once 4.1.4 is released and you can confirm code completion and linting are really working all the time (even when I've done extensive testing to be sure of that, you never know).
Hi @ccordoba12, the linting still does not work in version 4.1.4, see
https://stackoverflow.com/questions/59250636/how-to-turn-on-off-code-analysis-features-in-spyder-4/62519212#62519212 again for some screenshots. Code completion works.
@lorenzznerol, I saw you said that happens after a long time. Well, then things seems really hard to reproduce. And you also have the option to restart the Language Server from the status bar to get things back to life.
So unless you give us a way to reproduce the bug, I'm afraid there's nothing we can do about that, sorry.
@ccordoba12 yes, the issue appeared after quite some time in the one file - call it file1, but I was working on file2 all the time. I had not done anything more than changing slightly 3 lines here, commenting out 2 of them:
df.columns
df.head(1).to_string()
df.set_index(['time'], inplace = True)
I commented 2 code lines during some testing, and then only the errors appeared. That is why it may be reproducible.
The strange thing is that the comment signs were set right at the start of the line, although they should have been indented by one tab distance, because I was in the main block that starts with "if __name__ == '__main__':".
First the already known bug documentation.
Against the announcement, I have the issue again even in version 4.1.4 (Windows 10 Home, 64bit). I do not see a working linting: there are errors reported that should not be there. At least the code completion works.
Examples.
Here, "x" should be unknown and underlined, I have changed it to parameter "a" on purpose, yet it is not underlined:
Here you see an indentation error and afterwards an underlined comment, although both lines are OK. Mind that the comment sign should have been one tab to the right instead, because I was in the block of "if __name__ == '__main__':"
The strange behaviour came up only after quite some time (but as said above, I was not working on the file, that is why this information might be irrelevant).
If I comment them now, the comment sign is set with the right indentation (one tab right from the editor border). But there is a new indentation issue afterwards.
If you use ctrl+1 and then toggle back, the comment leaves one space more than the full revert would need.
1) after ctrl+1
2) after ctrl+1
3) after ctrl+1
3_error) (the error is usually this one. I have seen one different error once, which was also very general and I forgot)
4) after ctrl+1
5) after ctrl+1
6) after ctrl+1
7) after ctrl+1
8) after ctrl+1 (indentation error stops after 2 shifts here)
Now I check what is happening when I mark the block and press shift-tab to get the code indentation aligned to the editor border. First I comment the other 2 lines (probably not even needed):
Then I mark the 3 lines and press shift+tab
Obviously, the indentation is the whole issue. It seems not to be recognised by Python as the standard indentation.
file2 instead had no errors, but I also do not remember any linting at all there from the start, I have not checked it. After restart, there were about a dozen yellow underlinings per about 50 lines. It was saying something like "cannot give you any help here", and when I clicked on it, all of the yellow underlinings went away and did not come back.
I have opened a new issue only for version 4.1.4 at https://github.com/spyder-ide/spyder/issues/13381, as the code completion works now and it seems to be a different problem now with indentation toggling ctrl+1.
Most helpful comment
Now I have used
spyder --debug-info verbose --debug-output file
in anaconda prompt, and spyder opened. The linting suddenly works. I added a missing parameter, and the linting vanished as you would expect it. I do not know if this is now because of the debug opening or because I have restarted Spyder after some changes - and change-backs - in the Completion and linting menu. Anyway, now it works :)