-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Connecting to the kernel never succeeds. #21937
Comments
Hey @meltingSnowdrift, thanks for reporting. Please go to this entry in the File menu and select After Spyder restarts, go to the open the first file and upload it here. Note: The numbers at the end of |
Here is the requested file. |
Suspecting that the problem may be related to the space which occurs in the file path of the kernel, I installed Anaconda at a path which does not contain spaces and tried to use that as a kernel. This did not fix the issue. I therefore consider it unlikely that the cause of the issue is a file path containing spaces. Because Anaconda was used this time instead of Miniforge, I also consider it unlikely that the cause is specific to Miniforge. |
@meltingSnowdrift, good thinking! Actually, that could very well be the case because you installed Spyder in But don't worry, we're working right now to solve that problem. A fix will be available in our next version (5.5.4), to be released at the end of the week or beginning of the next one. |
I have installed Spyder 5.5.4. The problem is not fixed. Collecting evidence this time was somewhat frustrating. Upon first launching Spyder with the interpreter set to the one I want to use, the problem occurs as described in this thread. However, upon closing and launching Spyder again (whether manually or as part of restarting in debug mode), I get a different error message in the console area saying that some network port is already in use:
I am unsure whether this error message reveals anything about the problem or even whether it is related to the same problem at all. This error message happens whenever I start Spyder after having previously started and closed Spyder with that interpreter selected. This state appears to be reset by restarting the computer, but seems to persist even when there are no "python" executables" running. In other words: Such an error message would very occasionally appear during previous efforts to reproduce the issue, but now appears to be appearing consistently. I therefore present two log files: one in which this happens and another in which, after this happens, I close that console, causing a new one to open, which reproduces the original behaviour I was complaining about. Thank you for your patience. |
In a further test today, I tried installing both Spyder and Miniforge at paths with no spaces. This did not fix the problem and did not appear to change anything. If the problem is caused by spaces in file paths at all, the only potentially relevant one remaining would seem to be the one in my username. I have just conducted another test on my personal computer at home. On this computer, my username does not have spaces, and Spyder appears to work correctly there. This is suggestive but not indicative because there are plenty of other differences between this personal computer and the institutional computer on which the problem occurs. Please do not trust this interpretation too much, as there are many things I am not sure about and many ways in which I may be wrong. |
Hey @meltingSnowdrift, sorry for the late reply. You said:
That's not good, of course.
But I think this shows that at least spaces in directories are not the culprit anymore.
I agree with your analysis. Do you have a VPN or firewall enabled at your institution? That could be causing this issue. Also, please open a system terminal (i.e. cmd.exe) and run there
and post the output here. That could help us to better understand your problem. |
Results of running your specified commandRunning that line unmodified in I then modified the line to surround every file path in it with quotation marks, such that it now reads:
This produced the following output:
The program then apparently froze, neither producing more output nor terminating. As I write this, it has remained in this state for more than half an hour. An unexpected clueA potentially significant piece of evidence recently delivered itself to me in a surprising way. On April 19, when I started up the computer, there appeared the dialog Windows uses to ask the user to select a program to open a file without a file extension. This was not caused by any user action: it occurred immediately when I logged into my account. In this dialog, I selected a text editor, which opened a text file with the following contents:
This file exists at the path
Though I immediately suspected some connection between this file and Spyder problems, I was also concerned that it could be something else with potential security implications, so I asked my organization's technical support department. They assessed with very high confidence that this file is related to Spyder. I suspect that it is not accidental that the file path of this file is the substring of the path of my user folder which ends at the first space in that path. This leads me to again suspect that spaces in file paths have at least some role in the problem. This suspicion is supported by the presence of something called I admittedly have no idea why Windows would try to open this file upon startup. However, this behaviour may prove quite fortunate, as it has made me aware of the existence and contents of this file. |
Thanks for the updates @meltingSnowdrift. About them:
Thanks for doing that. I wasn't sure if my initial command was going to work without the quotes (I don't use Windows, so I couldn't test).
That's fine. The command I asked you to run starts a Spyder kernel, which is like a server waiting for code to be run on it (that's the reason why it stays open for ever).
Did you close the console where you started the command I posted? That could be the cause of this.
I think this means we still have an issue with spaces in paths that we need to fix. To give you a bit more context about my guess: every Spyder kernel needs to create a file with its connection info so Spyder can read that file and communicate with it. In this case it seems the command I posted created that file precisely in |
@dalthviz, could you help me with this one? For this you'd need to create a Windows account with spaces on its name and use our app to start an external kernel on it. If everything goes well, you should be able to reproduce @meltingSnowdrift's issue. If that doesn't work, you could try to run our activation command directly, i.e. something like this:
My guess is that the kernel connection file is not quoted in our activation script and that's what's causing this problem. |
Checking the command I can reproduce the behavior described at #21937 (comment) I see that a kernel starts but instead of the full path to the kernel connection file, the message shows a truncated one.
I think that's correct. @meltingSnowdrift could you check if changing
in your Spyder installation for something like "%CONDA_ENV_PYTHON%" -m spyder_kernels.console -f "%SPYDER_KERNEL_SPEC%" helps? Let us know! |
Just in case, created #22028 . To test if the fix helps, you can download the Windows installer generated by that PR (note that running it will uninstall the Spyder version you are using!): https://github.com/spyder-ide/spyder/actions/runs/8853573213?pr=22028 |
I am happy to report that this version works. For the first time in many weeks, Spyder runs in a usable form on the institutional computer.
The symptom involving the file being opened automatically at startup occurred before I ever tried your command in any form. Thank you to both of you for your patience and effort. |
That's great news @meltingSnowdrift! Thanks for your patience with this problem, your help and feedback were critical to solve it. |
Description
What steps will reproduce the problem?
The resulting behaviour is that the console continuously shows "Connecting to kernel..." without ever succeeding. This issue does not appear to be affected by the presence of any other packages in the environment.
If I start with the built-in Python interpreter (which works correctly), perform steps 1 and 2, and then use the restart kernel command, horizontal lines repeatedly appear one after the other. This suggests to me, along with some other testing, that the kernel is being repeatedly started but not successfully connected to.
Versions
Dependencies
Environment
Environment
The text was updated successfully, but these errors were encountered: