question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot start ipython kernel after fresh install of spyder within a conda environment in Windows 10

See original GitHub issue

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

I am encountering an error inside ipython console in spyder after a fresh install in a new conda environment. This error is reproducible in python 3.5.x, 3.6.x, and 3.7.x and on two different PCs using Windows 10 and Windows 7. Also I have tried different anaconda channels — conda, anaconda, and conda-forge all leading to the same issue.

Starting jupyter qtconsole directly does not return the error bellow. Also running spyder from a pip installation does not reproduce the error.

A temporary solution I found is to downgrade ipykernel to version 4.8.2 which removes the error but adds the following warning message at the start of the console C:\Users\markovic\Miniconda3\envs\spyder\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies, the kernel may be left running. Please let us know about your system (bitness, Python, etc.) at ipython-dev@scipy.org ipython-dev@scipy.org""")

What steps reproduce the problem?

  1. conda create -n spyder python=3
  2. conda activate spyder
  3. conda install spyder
  4. start spyder

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

In addition to the ipykernel error inside the console:

An error ocurred while starting the kernel
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site‑packages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'

I also get the following warning inside the anaconda prompt js: Not allowed to load local resource: file:///C:/Users/usarename/Miniconda3/envs/spyder/lib/site-packages/spyder/utils/help/static/css/default.css This warning also disappears after a downgrade to ipykernel 4.8.2

Paste Traceback/Error Below (if applicable)

WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:KernelRestarter: restart failed
WARNING:traitlets:kernel died: 18.00324773788452

Versions

  • Spyder version: 3.3.1
  • Python version: 3.7 (but also 3.6.x and 3.5.x)
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Win10 x64bit

Dependencies

IPython >=4.0     :  6.5.0 (OK)
cython >=0.21     :  None (NOK)
jedi >=0.9.0      :  0.12.1 (OK)
matplotlib >=2.0.0:  None (NOK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  None (NOK)
pandas >=0.13.1   :  None (NOK)
pycodestyle >=2.3 :  2.4.0 (OK)
pyflakes >=0.6.0  :  2.0.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
pylint >=0.25     :  2.1.1 (OK)
qtconsole >=4.2.0 :  4.4.1 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.7.8 (OK)
sympy >=0.7.3     :  None (NOK)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:31 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
ccordoba12commented, Sep 6, 2018

Please close Spyder, open an Anaconda Prompt, run there

conda install -n spyder ipykernel=4.8.2

and try again.

1reaction
CAM-Gerlachcommented, Dec 24, 2018

conda install -n spyder ipykernel=5.1

As you can see from the documentation, the -n flag performs the install into the named environment, and the error message therefore tells you that such an environment does not exist on your system (as you have not created it like the OP stated they did, with conda create -n spyder python=3.6).

Therefore, you should simply run conda install ipykernel=5.1 into whatever environment Spyder is installed in (base, by default) to accomplish the same, or else perform the steps as described by the OP to create a dedicated environment for Spyder, if you so choose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Illnesses — Spyder 5 documentation
To do so, activate the environment, then install spyder-kernels . If using Anaconda, open a terminal (Anaconda Prompt on Windows) and run:.
Read more >
Spyder not working with Anaconda "An error ocurred while ...
The cause for the error is that the currently recommended download package for Anaconda 3.8 does not come with the newest version of...
Read more >
Installing the IPython kernel — IPython 8.7.0 documentation
The IPython kernel is the Python execution backend for Jupyter. ... For example, using conda environments, install a Python (myenv) Kernel in a...
Read more >
How to connect Jupyter Notebook with Spyder Kernel - YouTube
How to connect Jupyter Notebook with Spyder Kernel | Open Jupyter Notebook variables in spyder1. conda install spyder -notebook -c ...
Read more >
Using Conda Python Environments with Spyder IDE and ...
Open the jupyter browser , you can see the new environment in the 'New' ... install spyder kernel inside the environment with following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found