spyder: Spyder ipython console throws "An error ocurred while starting the kernel" when restarting kernel

Description

When restarting ipython kernel or opening a new ipython console session within Spyder, it crashes. Below is the error message. However, the very first ipython console session that get’s opened by Spyder, does work. I have reinstalled anaconda with a fresh new download but the problem keeps appearing.

An error ocurred while starting the kernel
Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 183, in 
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/IPython/__init__.py", line 48, in 
from .terminal.embed import embed
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/IPython/terminal/embed.py", line 16, in 
from IPython.core.interactiveshell import DummyMod
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/IPython/core/interactiveshell.py", line 31, in 
from pickleshare import PickleShareDB
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/pickleshare.py", line 41, in 
from path import path as Path
File "/Users/asierberra/anaconda/lib/python3.5/site‑packages/path.py", line 123, in 
__version__ = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

What steps will reproduce the problem?

  1. Open spyder and work in ipython consol
  2. Open a new ipython console tab, or restart current kernel

What is the expected output? What do you see instead?

Please provide any additional information below

Version and main components

  • Spyder Version: 2.3.7
  • Python Version: 3.5.0
  • Qt Versions: 4.8.7, PyQt4 (API v2) 4.11.4 on Darwin
  • OsX 10.11.1

Optional dependencies

pyflakes >=0.6.0   :  1.0.0 (OK)
pep8 >=0.6         :  1.6.2 (OK)
pygments >=1.6     :  2.0.2 (OK)
IPython >=1.0      :  4.0.0 (OK)
zmq >=2.1.11       :  14.7.0 (OK)
qtconsole >=4.0    :  4.1.0 (OK)
pandas >=0.13.1    :  0.17.0 (OK)
sphinx >=0.6.6     :  1.3.1 (OK)
psutil >=0.3       :  3.2.2 (OK)
rope >=0.9.2       :  0.9.4-1 (OK)
jedi >=0.8.1;<0.9.0:  0.9.0 (NOK)
matplotlib >=1.0   :  1.4.3 (OK)
sympy >=0.7.3      :  0.7.6.1 (OK)
pylint >=0.25      :  None (NOK)

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Reactions: 1
  • Comments: 107 (40 by maintainers)

Most upvoted comments

Hi guys, the trick for me was: tools -> Reset Spyder to Factory Defaults

Please try to run

conda update setuptools

to see if that fixes your problem.

i think there is an incompatibility issue in my case

So i tried conda update --all and conda update spyder

this fixed my problem

hi everyone even i am facing same problem while starting the kernel

@mrunmayee17 Just like every other “same problem” posted on this thread, this is not the same problem, as every single line of your error traceback is totally different from the one posted in the original post. In fact, like four other posters on this tread, this comes down to the same basic Python user mistake, completely unrelated to Spyder, that should be pretty clear if you read your traceback (which is no different from any other Python traceback you might see from your own code).

As you can see, your File "/Users/mrunmayeerane/datetime.py" is overriding the standard library datetime when the kernel tries to load it, and so it breaks. To fix this, you should never name your files the same as Python standard library modules. Thanks.

Why environment with py36 works well apart from the one with py27?

Because Python 3.6 is a modern version of Python that has proper Unicode support for special characters, while Python 2.7 is ancient, ten years old and going to be end of life in less than a year, and thus should be avoided if at all possible.

How can I rename the folder? I do not see ‘rename’ button when click at the folder.

Did you try Googling it?

Ok, probably Windows doesn’t change your C:\Users<your user> folder after you change your user name. And that folder’s name is what you really need to change.

Thanks, It worked well.

for me, I did: tools -> Reset Spyder to Factory Defaults

Resetting solved this for me too. Couldn’t connect to kernel before the reset.