33

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.

YassineA
  • 331
  • 1
  • 3
  • 5
  • I have the same problem on OSX 10.9, installation from anaconda, Spyder 2.3.2 Python 2.7.9 64bits, Qt 4.8.6, PyQt4 (API v2) 4.10.4 on Darwin – jolvi Jan 07 '15 at 17:56
  • I solved this on one installation (OS X) by ignoring the initial Ipython window and opening a new one from the menu. – Carl Witthoft Jan 07 '15 at 17:56
  • I'll also add that things are a bit odd, as I get different behavior from *anaconda* than I do from *algorete* even tho' the latter claims to be built purely on the former. – Carl Witthoft Jan 07 '15 at 17:57
  • 2
    I have solved by uninstalling and reinstalling python(x,y) AND deleting related folders (.ipython and .spyder2) in the user folder, but I still do not understand what happened ... – YassineA Jan 09 '15 at 10:48
  • (*Spyder dev here*) Sorry that you've had this problem. We are trying to improve how we start IPython consoles for our next major release (i.e. 2.4). Right now it depends in some convoluted internal procedure that we hope to simplify as much as we can :-) – Carlos Cordoba Jan 12 '15 at 03:10
  • @CarlosCordoba I'm having this problem and nothing is fixing it. Completely uninstalling and reinstalling pythonxy and python itself, deleting .ipython and .spyder, Reset Spyder. Still not working. Windows 7 Python(x,y)-2.7.10.0 – endolith Jul 22 '15 at 14:45
  • @endolith, I think this problem was definitely fixed in `pyzmq` 14.6.0. This is a dependency of the IPython console, needed to create and connect to kernels. Perhaps Python(x,y)-2.7.10.0 doesn't come with it. – Carlos Cordoba Jul 23 '15 at 23:45
  • @CarlosCordoba Python(x,y)-2.7.10.0 comes with pyzmq 14.7.0-14 https://code.google.com/p/pythonxy/wiki/Downloads – endolith Jul 24 '15 at 02:22
  • @endolith, then I don't know what's happening. Try to deactivate your firewall and/or antivirus and try again. Those could be blocking communication with the kernel too. – Carlos Cordoba Jul 24 '15 at 13:26

17 Answers17

14

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 conda I succeeded by:

conda update pyzmq

conda update ipykernel

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
meCHAoT
  • 336
  • 3
  • 9
11

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

gustavgans
  • 5,141
  • 13
  • 41
  • 51
2

Another possible solution to this problem is to update your pyzmq library to version 14.6.0 or higher, which should fix this problem in Windows 8.

If you are using Anaconda, you just need to do

conda update pyzmq

to do that.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
1

Removing /anaconda/lib/python2.7/site-packages from PYTHONPATH manager in Spyder solved this for me.

bdanalytics
  • 55
  • 2
  • 10
1

Try typing these 3 lines from the anaconda command prompt:

conda create -n spyder python=2.7 spyder

activate spyder

spyder

1

I had the same issue in Anaconda. I updated the spyder-kernels module and it seems to work fine now.

s-jevtic
  • 51
  • 1
  • 6
1

Also had the same problem. Firstly, I solved this problem by spyder --reset. But when I turned into my working project tree, this problem happened again. So I reinstalled anaconda and upgraded spyder, but unfortunately, this problem remained unsolved.

Then I thought, why spyder --reset could work? Then I began a new empty project, and this problem didn't happen. So I realized that maybe there is something wrong with my working project.

After some searching, I found that a file named decorator.py may be the problem. Whatever project I moved this file in, the problem happened again. Then I changed the name of this file as Decorator.py, the problem was solved. So my advice is switching your working project to a new project, then watch whether this problem could happen again.

But afterwards, I still do not know why python file can't be named decorator.py. If somebody knows, please tell me.

HtPsi
  • 11
  • 1
1

spyder --reset worked for me. It resets most of the settings so you need to set it again. Better to remember/notedown your spyder setting before resetting it. Cheers.

amit
  • 41
  • 3
0

Had the same issue. I closed the console window, then opened a new one (CTRL+T) and that fixed it. Problem didn't come back after a restart.

gerardus
  • 3
  • 3
0

A very special thing happened to me, but it raised the same error ("connecting to kernel" freeze on Spyder): a '.' has accidentally slipped into my "pytable.py" file from pandas. Probably I opened it after an error and changed it / saved it accidentally.

So, if you are using anaconda, check if by mistake a file in ...\Continuum\Anaconda\Lib\site-packages was changed ( sort file by date and see if a file was modified today for instance)

After fixing the changed file, everything is back to normal.

0

Disabling anti-virus helped me resolve this issue instantly. Once the console was displayed, I enabled my anti-virus again.

Abhishek K
  • 645
  • 1
  • 11
  • 23
0

Had the same problem. At first it couldn't find the kernel. Closing Consol and reopening did not work. However, what did work was closing Spyder and then reopening. Note: I am running from python(x,y), not Anaconda.

Hossein Golshani
  • 1,847
  • 5
  • 16
  • 27
0

I was stuck with this error for a long time, I tried all the solutions above and the only one that resolved was to reset Spyder:

spyder --reset

cdutra
  • 587
  • 6
  • 15
0

I tried most of the answers here on stackoverflow and nothing helped (except a new environment but that only briefly).

After all, restarting the machine did it for me...

Big Thank You to the whole team of Spyder, always a delight seeing their answers posted in the community.

Magnus
  • 305
  • 3
  • 12
0

Go to preferences -> Python interpreter and change the interpreter from Default to a given path. In my case '/usr/bin/python3.6' worked.

0

I deleted all existing python copies on my system, deleted ANACONDA, rebooted my PC, installed ANACONDA again and then voila, it worked for me.

enter image description here

0

I still use Spyder 4.2.5 and Python 3.8. In my case, I tried most of the recommendations written here, but updating the kernel module (writing and running pip install spyder-kernels in the Anaconda prompt) worked.