Cannot start ipython kernel after fresh install of spyder within a conda environment in Windows 10
See original GitHub issueIssue 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
(orpip
, 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?
conda create -n spyder python=3
conda activate spyder
conda install spyder
- 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:
- Created 5 years ago
- Comments:31 (17 by maintainers)
Top GitHub Comments
Please close Spyder, open an Anaconda Prompt, run there
and try again.
As you can see from the documentation, the
-n
flag performs theinstall
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, withconda 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.