Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython console in Spyder stuck on "connecting to kernel"

I am new to python and coming from Matlab and I have installed the latest version of Python(x,y) (2.7.9.0) on my Win 8 64 bit PC.

The problem that I have is that, each time I start Spyder, the default IPython console gets stuck on "connecting to kernel". I can see that a new kernel is launched each time because a new .json file appears in the directory ".ipython\profile_default\security". I can access this kernel by opening a new IPython console by clicking on "connect to an existing kernel" and then browsing to find it, then it works fine (except that the variables I create do not appear in the variable explorer). I can also quit the kernel from this new IPython console but this does not solve my problem because when I launch a new IPython console by clicking on "open an IPython console" or restarting Spyder, it still hangs on "connecting to kernel" and creates a new .json file.

The closest issue that I could find on a forum is this one, the only difference being that I do not have the "import sitecustomize" error in the internal console. I have tried uninstalling Python(x,y) and python but to no avail. Any hint would be really appreciated.

like image 373
YassineA Avatar asked Jan 06 '15 16:01

YassineA


People also ask

How does Spyder connect to kernel?

Click Connect to an existing kernel from the Console menu or the IPython Console pane's “Gear” menu. Browse for or enter the path to the connection file from the previous step. If you're connecting to a local kernel, click Ok and Spyder should connect to the kernel; if a remote kernel, proceed to the final step.

How does Spyder solve kernel error?

If the kernel displays a long error traceback that mentions other packages like ipython , ipykernel , jupyter_client , traitlets or pyzmq , the problem may be an out of date or incompatible version of a dependency package. To fix this, activate the environment and update the key dependencies.

How do I get my IPython console back on Spyder?

3.2 Change Spyder settings to always start with an IPython shell. Go to Preferences -> IPython console -> Startup and select the tickbox next to Open an IPython console at startup. Then click the OK button. The next time Spyder starts, it will show the IPython console automatically.

How do I reset my Spyder kernel?

Open spyder. Create any variable in the console (this step is not necessary). Choose "Restart kernel" option from the console "hambrger icon". Accept by pressing "OK".


2 Answers

In my case I had to update the package ipykernel as well (on Python 3.6.3 | Anaconda 64-bit | Windows 10). Now my Spyder can spawn conoles in reasonable time.

Using pip I succeeded by:

pip install -U pyzmq

pip install -U ipykernel

like image 150
meCHAoT Avatar answered Oct 14 '22 23:10

meCHAoT


I run "Reset Spyder Settings" from the Windows Menu in the Anaconda section.

like image 41
gustavgans Avatar answered Oct 14 '22 21:10

gustavgans