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

Problem Description

I use anaconda to install python and spyder, and use two environment.But when first open spyder the Ipython console gives an error.

What steps will reproduce the problem?

  1. reset spyder
  2. open it

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

Paste Traceback/Error Below (if applicable)


An error ocurred while starting the kernel
Traceback (most recent call last):
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 268, in 
main()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 252, in main
kernel.initialize()
File "", line 2, in initialize
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\ipykernel\kernelapp.py", line 452, in initialize
zmq_ioloop.install()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
Traceback (most recent call last):
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 268, in 
main()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 252, in main
kernel.initialize()
File "", line 2, in initialize
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\ipykernel\kernelapp.py", line 452, in initialize
zmq_ioloop.install()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
Traceback (most recent call last):
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 268, in 
main()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 252, in main
kernel.initialize()
File "", line 2, in initialize
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\ipykernel\kernelapp.py", line 452, in initialize
zmq_ioloop.install()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
Traceback (most recent call last):
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 268, in 
main()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 252, in main
kernel.initialize()
File "", line 2, in initialize
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\ipykernel\kernelapp.py", line 452, in initialize
zmq_ioloop.install()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
Traceback (most recent call last):
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 268, in 
main()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 252, in main
kernel.initialize()
File "", line 2, in initialize
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\ipykernel\kernelapp.py", line 452, in initialize
zmq_ioloop.install()
File "D:\code\python\Anaconda\envs\python27\lib\site‑packages\zmq\eventloop\ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'

Package Versions

  • Spyder:3
  • Python: 2.7 and 3.6
  • Qt:
  • PyQt:
  • Operating System: win 10

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

Thanks for reporting. Try running the following from the Anaconda prompt or reinstalling Anaconda

conda update spyder ipykernel tornado pyzmq

Also, Please try the steps listed in the Spyder Troubleshooting Guide, specifically the Basic First Aid and Emergency CPR sections, which resolve the great majority of Spyder installation issues.

If it still isn’t working, please describe in detail the circumstances in which the error occurred, and post the information listed in relevant subsection of the Calling for Help section as a comment to this issue, and we’ll try to help if we can. Otherwise, your issue will likely have to be closed after one week (7 days). Thanks, and best of luck!

@sumitroy630, the error you posted above is caused by this file

C:\Users\HP\random.py

Please remove it or rename it to something other than random.py and your problem will be fixed.