Repository: spyder-ide/spyder

Issue:
An error ocurred while starting the kernel: b''
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [ x Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [x] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
    * [x] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [x] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description
I have seen a lot of posts of people who have the same error as I. I also get the message: b''
Im unsure what it means.

This is a totally fresh installation on windows 10 on my laptop. I already installed anaconda + spyder on my desktop and it works without a problem. The installation on my laptop just doesn't work.


### What steps reproduce the problem?

1. Download and install newest version of anaconda.
2. Launch spyder
3. (same procedure works fine on my desktop)

### What is the expected output? What do you see instead?



### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

Spyder Internal Console

This console is used to report application
internal errors and to inspect Spyder
internals with the following commands:
  spy.app, spy.window, dir(spy)

Please don't use it to run your code

>>> WARNING:traitlets:kernel died: 18.001706838607788

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 3.3.2
* Python version: 3.7
* Qt version: 
* PyQt version: 
* Operating System name/version: Win10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
IPython >=4.0     :  7.2.0 (OK)
cython >=0.21     :  0.29.2 (OK)
jedi >=0.9.0      :  0.13.2 (OK)
matplotlib >=2.0.0:  3.0.2 (OK)
nbconvert >=4.0   :  5.4.0 (OK)
numpy >=1.7       :  1.15.4 (OK)
pandas >=0.13.1   :  0.23.4 (OK)
pycodestyle >=2.3 :  2.4.0 (OK)
pyflakes >=0.6.0  :  2.0.0 (OK)
pygments >=2.0    :  2.3.1 (OK)
pylint >=0.25     :  2.2.2 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.8.2 (OK)
sympy >=0.7.3     :  1.3 (OK)
```



Discussion:
Please an Anaconda Prompt, run there

    conda install -f spyder-kernels=0.3

and try again.
Hi, 
I have the same problem. I do these stages to install theano and after that when I want to implement my codes in spyder it produces the same mentioned error. 
Run conda update conda
Run conda update --all
Run conda install mingw libpython
Install the latest version of Theano, pip install git+git://github.com/Theano/Theano.git
Run pip install git+git://github.com/fchollet/keras.git

now I have Python 3.6.8 and IPython 7.2.0 on windows 10 and it only produces this error "An error occurred while starting the kernel: b'' " without any explanations. I change my setting to factory setting or reinstall spyder, delete .ipyton folder but I could not solve my problem. please help me. I am a beginner and I really do not know what should I do now? thanks
@CAM-Gerlach, could you help us to see if you can reproduce this error by following @nadianaji's steps? Thanks!
This is how the console looks with this error:

![imagen](https://user-images.githubusercontent.com/365293/51352817-bebf8480-1a7c-11e9-9238-50d77dfac957.png)

This image was posted in:

https://stackoverflow.com/q/54235829/438386
@steff456 and @dalthviz, this is the error I was telling you about.

According to @nadianaji's report and the StackOverflow question I referenced above, it seems related to Tensorflow, Keras or Theano.
yes, my console is similar to this image. what should I do now? I should uninstall anaconda and all other related things?
@ccordoba12 Sure, I can try to repro it by that method after I get an environment set up, but if you're after the cause of the message in general rather than a particular manifestation of it (I'm not sure its actually one specific error, but a symptom of various potentially different lower-level problems), I have at least one semi-consistent way to trigger it, as I have encountered this error message before on other issues.

For example, it would be displayed in the Console when triggering the ``mkl`` "ordinal 241" crash from issue #7357 by importing matplotlib in the console after Spyder has already started; I also saw the message at least once when updating to different versions of IPython and ``ipykernel`` to try to isolate another problem, but it went away after I restarted the kernel and didn't re-occur.
@CAM-Gerlach, I hope you can find a reproducible set of circumstances that I can use to debug and fix this problem. Until then, it's a mystery to me.
@ccordoba12 Okay sure; I'll go set up an environment with Theano and see if I can repro it by the method above, as well as determine if it can be isolated to any specific dependency versions and if anything else useful can be gleaned.
Thanks @CAM-Gerlach!
@ccordoba12 To make a long story short, I spent several hours testing and troubleshooting this, going through the entire procedure both as specified by @nadianaji and several other ways of installing Keras and Theano, with different dependencies, before I realized that the weird build errors I was getting was due to having another old MinGW install somewhere on my PATH, which I resolved by renaming it and removing it from my PATH and environment variables. Everything worked, except for ``import theano``, which was an unrelated problem.

I repeated the entire procedure from the beginning with a brand-new, clean environment with this fixed on my Windows 8.1 x64 machine and the latest Spyder ``master`` as of this post date, and ``import theano`` worked as well. At no point was I able to reproduce the error @nadianaji got. I also fixed the other problem that triggered the error (over in #7357 ) and couldn't repro it there either. The one thing is it seems every instance of it has to do with some low-level compiled code, either from Theano/Keras, Tensorflow, or MKL/OpenMP.

@nadianaj Can you try the exact procedure as the first code block in the below Details section (installing everything into a clean, isolated environment), and can you reproduce the error? If so, can you provide the ``conda list`` of that environment? If not, can you provide a ``conda list`` of the environment in which you get the error? Thanks!

The full description and report of my findings, for the (morbidly) curious:

<details>

First, following @nadianaji as verbatim as practicable:

```
conda update -n base -c defaults conda
conda create -n theano-test python=3.6
activate theano-test
conda install spyder-kernels=1 mingw libpython
pip install git+git://github.com/Theano/Theano.git
pip install git+git://github.com/fchollet/keras.git
```

I opened a copy of Spyder (in another environment) off the latest ``master`` and set the ``Python interpreter`` to be the one in the Theano environment. After installing each of Spyder-Kernels, etc., Theano, and Keras, I tested starting a new kernel, running basic commands and importing the installed packages. After each of the above command, I closed, re-opened and re-tested in Spyder.

After installing the basic packages, the kernel started fine and I could run simple commands. This was unchanged after installing Theano, and I didn't get any compilation or install errors building the package and all the messages indicated success. Importing it, I got a number of warnings, but everything worked:

```
 WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`
C:\Anaconda3\envs\theano-test\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
  warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
WARNING (theano.configdefaults): install mkl with `conda install mkl-service`: No module named 'mkl'
WARNING (theano.tensor.blas): Using NumPy C-API based implementation for BLAS functions.
```

Finally, installing Keras, I got the same successful build messages, and again the kernel 
launched successfully and simple commands worked. Again I got the above warnings to ``import theano``, but no error messages, and when attempting to ``import keras``, after setting it to use the ``theano`` backend it printed ``Using Theano backend.`` and otherwise appeared to work successfully.

The ``conda list`` of my environment is as follows:

<details>

```
# packages in environment at C:\Anaconda3\envs\theano-test:
#
# Name                    Version                   Build  Channel
backcall                  0.1.0                    py36_0
certifi                   2018.11.29               py36_0
cloudpickle               0.6.1                    py36_0
colorama                  0.4.1                    py36_0
decorator                 4.3.0                    py36_0
h5py                      2.9.0                     <pip>
ipykernel                 5.1.0            py36h39e3cac_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h3c5d0ee_0
jedi                      0.13.2                   py36_0
jupyter_client            5.2.4                    py36_0
jupyter_core              4.4.0                    py36_0
Keras                     2.2.4                     <pip>
Keras-Applications        1.0.6                     <pip>
Keras-Preprocessing       1.0.5                     <pip>
libpython                 2.1                      py36_0
libsodium                 1.0.16               h9d3ae62_0
mingw                     4.7                           1
numpy                     1.16.0                    <pip>
parso                     0.3.1                    py36_0
pickleshare               0.7.5                    py36_0
pip                       18.1                     py36_0
prompt_toolkit            2.0.7                    py36_0
pygments                  2.3.1                    py36_0
python                    3.6.8                h9f7ef89_0
python-dateutil           2.7.5                    py36_0
PyYAML                    3.13                      <pip>
pyzmq                     17.1.2           py36hfa6e2cd_0
scipy                     1.2.0                     <pip>
setuptools                40.6.3                   py36_0
six                       1.12.0                   py36_0
spyder-kernels            1.0.1                    py36_0
sqlite                    3.26.0               he774522_0
Theano                    1.0.4+4.gc72eafaff           <pip>
tornado                   5.1.1            py36hfa6e2cd_0
traitlets                 4.3.2            py36h096827d_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7            py36h3d5aa90_0
wheel                     0.32.3                   py36_0
wincertstore              0.2              py36h7fe50ca_0
zeromq                    4.2.5                he025d50_1
```

</details>

I then endeavored to address the warnings that had appeared when importing Theano, installing some additional conda packages (using the versions compatible with ``mkl=2018.0.2`` to avoid the MKL DLL bug on my system) and replacing the ones ``pip`` had installed:

```
pip uninstall --yes theano keras h5py numpy scipy pyyaml keras-applications keras-preprocessing
conda install m2w64-toolchain mkl-service mkl=2018.0.2 numpy scipy h5py pyyaml
pip install git+git://github.com/Theano/Theano.git
pip install git+git://github.com/fchollet/keras.git
```

Again, I tested opening a new Spyder instance and console after each command, basic commands, numpy import and commands, and importing Theano and Keras (as appropriate for each), and retested everything above, which all worked, this time without all the warnings on import.

``conda list`` output:

<details>

```
# packages in environment at C:\Anaconda3\envs\theano-test:
#
# Name                    Version                   Build  Channel
backcall                  0.1.0                    py36_0
blas                      1.0                         mkl
certifi                   2018.11.29               py36_0
cloudpickle               0.6.1                    py36_0
colorama                  0.4.1                    py36_0
decorator                 4.3.0                    py36_0
h5py                      2.9.0            py36h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
intel-openmp              2019.1                      144
ipykernel                 5.1.0            py36h39e3cac_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h3c5d0ee_0
jedi                      0.13.2                   py36_0
jupyter_client            5.2.4                    py36_0
jupyter_core              4.4.0                    py36_0
Keras                     2.2.4                     <pip>
Keras-Applications        1.0.6                     <pip>
Keras-Preprocessing       1.0.5                     <pip>
libpython                 2.1                      py36_0
libsodium                 1.0.16               h9d3ae62_0
m2w64-binutils            2.25.1                        5
m2w64-bzip2               1.0.6                         6
m2w64-crt-git             5.0.0.4636.2595836               2
m2w64-gcc                 5.3.0                         6
m2w64-gcc-ada             5.3.0                         6
m2w64-gcc-fortran         5.3.0                         6
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gcc-objc            5.3.0                         6
m2w64-gmp                 6.1.0                         2
m2w64-headers-git         5.0.0.4636.c0ad18a               2
m2w64-isl                 0.16.1                        2
m2w64-libiconv            1.14                          6
m2w64-libmangle-git       5.0.0.4509.2e5a9a2               2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
m2w64-make                4.1.2351.a80a8b8               2
m2w64-mpc                 1.0.3                         3
m2w64-mpfr                3.1.4                         4
m2w64-pkg-config          0.29.1                        2
m2w64-toolchain           5.3.0                         7
m2w64-tools-git           5.0.0.4592.90b8472               2
m2w64-windows-default-manifest 6.4                           3
m2w64-winpthreads-git     5.0.0.4634.697f757               2
m2w64-zlib                1.2.8                        10
mingw                     4.7                           1
mkl                       2018.0.2                      1
mkl-service               1.1.2            py36hb217b18_4
mkl_fft                   1.0.1            py36h452e1ab_0
mkl_random                1.0.1            py36h9258bd6_0
msys2-conda-epoch         20160418                      1
numpy                     1.14.3           py36h9fa60d3_1
numpy-base                1.14.3           py36h555522e_1
parso                     0.3.1                    py36_0
pickleshare               0.7.5                    py36_0
pip                       18.1                     py36_0
prompt_toolkit            2.0.7                    py36_0
pygments                  2.3.1                    py36_0
pyreadline                2.1                      py36_1
python                    3.6.8                h9f7ef89_0
python-dateutil           2.7.5                    py36_0
pyyaml                    3.13             py36hfa6e2cd_0
pyzmq                     17.1.2           py36hfa6e2cd_0
scipy                     1.1.0            py36h672f292_0
setuptools                40.6.3                   py36_0
six                       1.12.0                   py36_0
spyder-kernels            1.0.1                    py36_0
sqlite                    3.26.0               he774522_0
Theano                    1.0.4+4.gc72eafaff           <pip>
tornado                   5.1.1            py36hfa6e2cd_0
traitlets                 4.3.2            py36h096827d_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7            py36h3d5aa90_0
wheel                     0.32.3                   py36_0
wincertstore              0.2              py36h7fe50ca_0
yaml                      0.1.7                hc54c509_2
zeromq                    4.2.5                he025d50_1
zlib                      1.2.11               h62dcd97_3
```

</details>

Finally, I tested the ``conda`` packages themselves, by the same procedure:

```
pip uninstall theano keras keras-applications keras-preprocessing
conda install theano
conda install keras
```

Again, testing at each step and launching kernels, basic commands, importing and using NumPy, and importing Theano and Keras, everything worked fine with no errors or warnings.

``conda list`` output:

<details>

```
# packages in environment at C:\Anaconda3\envs\theano-test:
#
# Name                    Version                   Build  Channel
_tflow_select             2.2.0                     eigen
absl-py                   0.7.0                    py36_0
astor                     0.7.1                    py36_0
backcall                  0.1.0                    py36_0
blas                      1.0                         mkl
ca-certificates           2018.12.5                     0
certifi                   2018.11.29               py36_0
cloudpickle               0.6.1                    py36_0
colorama                  0.4.1                    py36_0
decorator                 4.3.0                    py36_0
gast                      0.2.2                    py36_0
grpcio                    1.16.1           py36h351948d_1
h5py                      2.9.0            py36h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
intel-openmp              2019.1                      144
ipykernel                 5.1.0            py36h39e3cac_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h3c5d0ee_0
jedi                      0.13.2                   py36_0
jupyter_client            5.2.4                    py36_0
jupyter_core              4.4.0                    py36_0
keras                     2.2.4                         0
keras-applications        1.0.6                    py36_0
keras-base                2.2.4                    py36_0
keras-preprocessing       1.0.5                    py36_0
libgpuarray               0.7.6                hfa6e2cd_0
libprotobuf               3.6.1                h7bd577a_0
libpython                 2.1                      py36_0
libsodium                 1.0.16               h9d3ae62_0
m2w64-binutils            2.25.1                        5
m2w64-bzip2               1.0.6                         6
m2w64-crt-git             5.0.0.4636.2595836               2
m2w64-gcc                 5.3.0                         6
m2w64-gcc-ada             5.3.0                         6
m2w64-gcc-fortran         5.3.0                         6
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gcc-objc            5.3.0                         6
m2w64-gmp                 6.1.0                         2
m2w64-headers-git         5.0.0.4636.c0ad18a               2
m2w64-isl                 0.16.1                        2
m2w64-libiconv            1.14                          6
m2w64-libmangle-git       5.0.0.4509.2e5a9a2               2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
m2w64-make                4.1.2351.a80a8b8               2
m2w64-mpc                 1.0.3                         3
m2w64-mpfr                3.1.4                         4
m2w64-pkg-config          0.29.1                        2
m2w64-toolchain           5.3.0                         7
m2w64-tools-git           5.0.0.4592.90b8472               2
m2w64-windows-default-manifest 6.4                           3
m2w64-winpthreads-git     5.0.0.4634.697f757               2
m2w64-zlib                1.2.8                        10
mako                      1.0.7                    py36_0
markdown                  3.0.1                    py36_0
markupsafe                1.1.0            py36he774522_0
mingw                     4.7                           1
mkl                       2018.0.2                      1
mkl-service               1.1.2            py36hb217b18_4
mkl_fft                   1.0.1            py36h452e1ab_0
mkl_random                1.0.1            py36h9258bd6_0
msys2-conda-epoch         20160418                      1
numpy                     1.14.3           py36h9fa60d3_1
numpy-base                1.14.3           py36h555522e_1
openssl                   1.1.1a               he774522_0
parso                     0.3.1                    py36_0
pickleshare               0.7.5                    py36_0
pip                       18.1                     py36_0
prompt_toolkit            2.0.7                    py36_0
protobuf                  3.6.1            py36h33f27b4_0
pygments                  2.3.1                    py36_0
pygpu                     0.7.6            py36h452e1ab_0
pyreadline                2.1                      py36_1
python                    3.6.8                h9f7ef89_0
python-dateutil           2.7.5                    py36_0
pyyaml                    3.13             py36hfa6e2cd_0
pyzmq                     17.1.2           py36hfa6e2cd_0
scipy                     1.1.0            py36h672f292_0
setuptools                40.6.3                   py36_0
six                       1.12.0                   py36_0
spyder-kernels            1.0.1                    py36_0
sqlite                    3.26.0               he774522_0
tensorboard               1.12.2           py36h33f27b4_0
tensorflow                1.12.0          eigen_py36h67ac661_0
tensorflow-base           1.12.0          eigen_py36h45df0d8_0
termcolor                 1.1.0                    py36_1
theano                    1.0.3                    py36_0
tornado                   5.1.1            py36hfa6e2cd_0
traitlets                 4.3.2            py36h096827d_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7            py36h3d5aa90_0
werkzeug                  0.14.1                   py36_0
wheel                     0.32.3                   py36_0
wincertstore              0.2              py36h7fe50ca_0
yaml                      0.1.7                hc54c509_2
zeromq                    4.2.5                he025d50_1
zlib                      1.2.11               h62dcd97_3
```

</details>

</details>
I just got to test the suggested input from @ccordoba12 .
`conda install -f spyder-kernels=0.3`
It didnt work. Is there a fix yet. I didn't understand much from the previous post.
@v1llum We're not sure exactly what is causing this, but it seems like it could be something low-level on your machine. Can you try the following from the Anaconda prompt—which will create an isolated environment and install and run Spyder from it in DEBUG mode—and let us know if it works, and if not what output you receive:

```
conda create -n spyder-env python=3.6
activate spyder-env
conda install spyder
set SPYDER_DEBUG=3
spyder
```

Thanks!
Hi @CAM-Gerlach, since I am facing the same error ("an error occurred while starting the kernel") while running a python command "import keras" in my newly installed anaconda env on windows 10, I have run the given above commands given by you as below:

conda create -n spyder-env python=3.6
activate spyder-env
conda install spyder
set SPYDER_DEBUG=3

=========================

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: / DEBUG menuinst_win32:__init__(196): Menu: name: 'Anacon
da${PY_VER} ${PLATFORM}', prefix: 'C:\Users\praveen\Anaconda3\envs\spyder-env',
env_name: 'spyder-env', mode: 'user', used_mode: 'user'
- DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\praveen\Anaconda3\p
ythonw.exe, args are ['C:\\Users\\praveen\\Anaconda3\\cwp.py', 'C:\\Users\\prave
en\\Anaconda3\\envs\\spyder-env', 'C:\\Users\\praveen\\Anaconda3\\envs\\spyder-e
nv\\pythonw.exe', 'C:\\Users\\praveen\\Anaconda3\\envs\\spyder-env\\Scripts\\spy
der-script.py']
DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\praveen\Anaconda3\pyt
hon.exe, args are ['C:\\Users\\praveen\\Anaconda3\\cwp.py', 'C:\\Users\\praveen\
\Anaconda3\\envs\\spyder-env', 'C:\\Users\\praveen\\Anaconda3\\envs\\spyder-env\
\python.exe', 'C:\\Users\\praveen\\Anaconda3\\envs\\spyder-env\\Scripts\\spyder-
script.py', '--reset']
done

(spyder-env) C:\WINDOWS\system32>spyder

===================

After lauching the spyder from Administrator anaconda prompt, the spyder crashed with a standard pop up message and with below track back:

### Spyder

Spyder crashed during last session.<br><br>If Spyder does not start at all and <u>before submitting a bug report</u>, please try to reset settings to defaults by running Spyder with the command line option '--reset':<br><span style='color: #555555'><b>spyder --reset</b></span><br><br><span style='color: #ff5555'><b>Warning:</b></span> this command will remove all your Spyder configuration files located in 'C:\Users\praveen\.spyder-py3').<br><br>If Spyder still fails to launch, you should consult our comprehensive <b><a href="https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ">Troubleshooting Guide</a></b>, which when followed carefully solves the vast majority of crashes; also, take the time to search for <a href="https://github.com/spyder-ide/spyder">known bugs</a> or <a href="https://groups.google.com/group/spyderlib">discussions</a> matching your situation before submitting a report to our <a href="https://github.com/spyder-ide/spyder">issue tracker</a>. Your feedback will always be greatly appreciated.

### OK

Tried 'spyder --reset' but no use, it still crashed. Hope this helps in some way to find a fix for this issue.


Also, just to let you know, below are the relevant packages (found from the different forums/threads) as of now in my anaconda env:

ipykernel = 5.1.0
pyzmq = 17.1.2
setuptools = 40.6.3

Let me know if I have downgrade any of these packages for fixing the issue.

@PraveenTumma FYI, as you can see the formatting on your above post makes the text very difficult to follow. To fix this, please enclose all code blocks in triple backticks (the `` ` `` character) in the future; I've done it for you in your post above just so I can read it properly.

> I am facing the same error ("an error occurred while starting the kernel")

What is the actual error message printed below this notification? ``b''`` or something else? As I've stressed to prior posters, without confirming *what* actual error occurred, it is not possible to give you specific help, as the "error" in question could be any number of things.

>  I have run the given above commands given by you as below:

As far as I can tell, you ran them all correctly and that is the normal, expected output.

> the spyder crashed with a standard pop up message and with below track back:

So, to confirm, this is the entire, *exact* text shown shown below ``(spyder-env) C:\WINDOWS\system32>spyder`` in the Anaconda prompt? It certainly is not a traceback of any description.

> ipykernel = 5.1.0

We haven't been able to isolate *this* issue to any specific dependency versions, since we haven't found a reliable way to reproduce it despite several attempts. Please re-open your original copy of Spyder, i.e. the one that is giving you the kernel error however you normally do, and see if the error text below the message reads *exactly* ``b''``, i.e., it will look like this:

![image](https://user-images.githubusercontent.com/17051931/52170499-0c8ceb80-2711-11e9-831f-22762941f10b.png)

If it *does not,* please refer to the issue thread(s) covering the specific error message shown, and follow the suggested steps there. One good thing to try (*only do this now if the error message does not read ``b''``*) is ``conda install ipykernel=4`` in the Anaconda prompt in your previous working environment (``base``, by default).

If it *does,* please confirm that here, as well as whether you have switched the console interpreter in Spyder under ``Preferences > Python interpreter`` from the default/same as Spyder option. Try restarting the kernel to make sure that doesn't fix it. Assuming it doesn't, please describe in detail how you installed Keras and any other related packages (with just ``conda install keras``? from ``conda-forge``? with ``pip``? In ``base`` or a separate environment?) and provide your full ``conda list`` and ``conda info`` output inside ``<details>`` tags, like this:

~~~
<details>

```
YOUR CONDA INFO OUTPUT

YOUR CONDA LIST OUTPUT
```

<details>
~~~

Then, try ``conda install --force-reinstall spyder-kernels=0`` again in your previous environment (not the new one, ``spyder-env``, that you created above), close/reopen Spyder and try it again. Finally, if that doesn't work, try ``conda install ipykernel=4``. If that still doesn't work, we'll advise you on what else you should try in either environment, based on your responses and output for the questions in this post. Thanks.
Thanks for your detailed response, @CAM-Gerlach. Yes, I confirm that I got the below error as shown by you:

**An error ocurred while starting the kernel: b''**

I have not switched any options in spyder.  I created new env (PythonCPU) in anaconda and installed Keras, spyder, pandas, matplotlib using conda commands only, pip is not at all used. 

<details>
(spyder-env) C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\praveen\Anaconda3\envs\spyder-env:
#

```

> 1. # Name                    Version                   Build  Channel
> 2. alabaster                 0.7.12                   py36_0
> 3. asn1crypto                0.24.0                   py36_0
> 4. astroid                   2.1.0                    py36_0
> 5. babel                     2.6.0                    py36_0
> 6. backcall                  0.1.0                    py36_0
> 7. bleach                    3.1.0                    pypi_0    pypi
> 8. ca-certificates           2018.12.5                     0
> 9. certifi                   2018.11.29               py36_0
> 10. cffi                      1.11.5           py36h74b6da3_1
> 11. chardet                   3.0.4                    py36_1
> 12. cloudpickle               0.6.1                    py36_0
> 13. colorama                  0.4.1                    py36_0
> 14. cryptography              2.4.2            py36h7a1dbc1_0
> 15. decorator                 4.3.0                    py36_0
> 16. docutils                  0.14             py36h6012d8f_0
> 17. entrypoints               0.3                      py36_0
> 18. icu                       58.2                 ha66f8fd_1
> 19. idna                      2.8                      py36_0
> 20. imagesize                 1.1.0                    py36_0
> 21. ipykernel                 5.1.0            py36h39e3cac_0
> 22. ipython                   7.2.0            py36h39e3cac_0
> 23. ipython_genutils          0.2.0            py36h3c5d0ee_0
> 24. isort                     4.3.4                    py36_0
> 25. jedi                      0.13.2                   py36_0
> 26. jinja2                    2.10                     py36_0
> 27. jpeg                      9b                   hb83a4c4_2
> 28. jsonschema                2.6.0            py36h7636477_0
> 29. jupyter_client            5.2.4                    py36_0
> 30. jupyter_core              4.4.0                    py36_0
> 31. keyring                   17.1.1                   py36_0
> 32. lazy-object-proxy         1.3.1            py36hfa6e2cd_2
> 33. libpng                    1.6.36               h2a8f88b_0
> 34. libsodium                 1.0.16               h9d3ae62_0
> 35. markupsafe                1.1.0            py36he774522_0
> 36. mccabe                    0.6.1                    py36_1
> 37. mistune                   0.8.4            py36he774522_0
> 38. nbconvert                 5.3.1                    py36_0
> 39. nbformat                  4.4.0            py36h3a5bc1b_0
> 40. numpydoc                  0.8.0                    py36_0
> 41. openssl                   1.1.1a               he774522_0
> 42. packaging                 18.0                     py36_0
> 43. pandoc                    2.2.3.2                       0
> 44. pandocfilters             1.4.2                    py36_1
> 45. parso                     0.3.1                    py36_0
> 46. pickleshare               0.7.5                    py36_0
> 47. pip                       18.1                     py36_0
> 48. prompt_toolkit            2.0.7                    py36_0
> 49. psutil                    5.4.8            py36he774522_0
> 50. pycodestyle               2.4.0                    py36_0
> 51. pycparser                 2.19                     py36_0
> 52. pyflakes                  2.0.0                    py36_0
> 53. pygments                  2.3.1                    py36_0
> 54. pylint                    2.2.2                    py36_0
> 55. pyopenssl                 18.0.0                   py36_0
> 56. pyparsing                 2.3.1                    py36_0
> 57. pyqt                      5.9.2            py36h6538335_2
> 58. pysocks                   1.6.8                    py36_0
> 59. python                    3.6.8                h9f7ef89_0
> 60. python-dateutil           2.7.5                    py36_0
> 61. pytz                      2018.9                   py36_0
> 62. pywin32                   223              py36hfa6e2cd_1
> 63. pyzmq                     17.1.2           py36ha925a31_2
> 64. qt                        5.9.7            vc14h73c81de_0
> 65. qtawesome                 0.5.5                    py36_0
> 66. qtconsole                 4.4.3                    py36_0
> 67. qtpy                      1.5.2                    py36_0
> 68. requests                  2.21.0                   py36_0
> 69. rope                      0.11.0                   py36_0
> 70. setuptools                40.6.3                   py36_0
> 71. sip                       4.19.8           py36h6538335_0
> 72. six                       1.12.0                   py36_0
> 73. snowballstemmer           1.2.1            py36h763602f_0
> 74. sphinx                    1.8.2                    py36_0
> 75. sphinxcontrib             1.0                      py36_1
> 76. sphinxcontrib-websupport  1.1.0                    py36_1
> 77. spyder                    3.3.2                    py36_0
> 78. spyder-kernels            0.3.0                    py36_0
> 79. sqlite                    3.26.0               he774522_0
> 80. testpath                  0.4.2                    py36_0
> 81. tornado                   5.1.1            py36hfa6e2cd_0
> 82. traitlets                 4.3.2            py36h096827d_0
> 83. typed-ast                 1.1.0            py36hfa6e2cd_0
> 84. urllib3                   1.24.1                   py36_0
> 85. vc                        14.1                 h0510ff6_4
> 86. vs2015_runtime            14.15.26706          h3a45250_0
> 87. wcwidth                   0.1.7            py36h3d5aa90_0
> 88. webencodings              0.5.1                    py36_1
> 89. wheel                     0.32.3                   py36_0
> 90. win_inet_pton             1.0.1                    py36_1
> 91. wincertstore              0.2              py36h7fe50ca_0
> 92. wrapt                     1.11.0           py36he774522_0
> 93. zeromq                    4.3.1                h33f27b4_3
> 94. zlib                      1.2.11               h62dcd97_3

```

```
(spyder-env) C:\WINDOWS\system32>

(spyder-env) C:\WINDOWS\system32>conda info

     active environment : spyder-env
    active env location : C:\Users\praveen\Anaconda3\envs\spyder-env
            shell level : 2
       user config file : C:\Users\praveen\.condarc
 populated config files : C:\Users\praveen\.condarc
          conda version : 4.6.2
    conda-build version : 3.17.7
         python version : 3.6.8.final.0
       base environment : C:\Users\praveen\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\praveen\Anaconda3\pkgs
                          C:\Users\praveen\.conda\pkgs
                          C:\Users\praveen\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\praveen\Anaconda3\envs
                          C:\Users\praveen\.conda\envs
                          C:\Users\praveen\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.6.2 requests/2.21.0 CPython/3.6.8 Windows/8.1
Windows/6.3.9600
          administrator : True
             netrc file : None
           offline mode : False


(spyder-env) C:\WINDOWS\system32>
```

</details>

==================
Now tried your other suggested solutions but unfortunately both did not work. Seeing the below error after spyder crash:

<details>

```
```conda install --force-reinstall spyder-kernels=0```
```conda install ipykernel=4```

```(base) C:\WINDOWS\system32>activate PythonCPU

(PythonCPU) C:\WINDOWS\system32>spyder
Traceback (most recent call last):
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py",
line 3284, in main
    mainwindow = run_spyder(app, options, args)
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py",
line 3139, in run_spyder
    main.setup()
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py",
line 844, in setup
    from spyder.plugins.editor import Editor
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\plugins\editor.py",
line 41, in <module>
    from spyder.utils.introspection.manager import IntrospectionManager
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\utils\introspection\
manager.py", line 21, in <module>
    from spyder.utils.introspection.plugin_client import PluginClient
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\spyder\utils\introspection\
plugin_client.py", line 18, in <module>
    import zmq
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\__init__.py", line 47,
in <module>
    from zmq import backend
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", l
ine 40, in <module>
    reraise(*exc_info)
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\utils\sixcerpt.py", lin
e 34, in reraise
    raise value
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\backend\__init__.py", l
ine 27, in <module>
    _ns = select_backend(first)
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\backend\select.py", lin
e 27, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "C:\Users\praveen\Anaconda3\Lib\site-packages\zmq\backend\cython\__init__
.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
[7668:5896:0203/203000.573:ERROR:broker_win.cc(59)] Error reading broker pipe: T
he pipe has been ended. (0x6D)

(PythonCPU) C:\WINDOWS\system32>
```

</details>

Thanks for confirming that and for providing the requested environment details, and sorry you're still having the problem. I fixed some issues with your post's formatting, as you can see. Make sure to use singe backtick (`` ` ``) or double backtick for inline code, and ``` above and below code blocks, as demonstrated in my previous post.

>  I created new env (PythonCPU) in anaconda and installed Keras, spyder, pandas, matplotlib using conda commands only, pip is not at all used.

Good; that sounds like the correct procedure.

> ``(spyder-env) C:\WINDOWS\system32>conda list # packages in environment at C:\Users\praveen\Anaconda3\envs\spyder-env:``

Sorry for the confusion, but I was requesting the ``conda list`` of your original (``PythonCPU``) environment, not ``spyder-env``. Could you provide that instead (*before making any further changes*)? Thanks.

> ```
> conda install --force-reinstall spyder-kernels=0
> conda install ipykernel=4
> (base) C:\WINDOWS\system32>activate PythonCPU
> (PythonCPU) C:\WINDOWS\system32>spyder
> ```

You apparently executed the install commands in your ``base`` environment, but then switched to the Spyder and default Spyder-Kernels in your ``PythonCPU`` environment instead, so they had no effect. What you should do, as I specified above, is run them one after another in your ``PythonCPU`` environment (*after* pasting the ``conda list`` output here), and after each command test Spyder (so we know which fixed it, if either does).

Furthermore, you should launch Spyder from your ``base`` environment (make sure its up to date first with ``conda update spyder spyder-kernels`` while ``base`` is activated), launch Spyder from there (or with the normal start menu shortcut), and then set the path under ``Preferences > Python interpreter > Use the selected Python interpreter`` to ``C:\Users\praveen\Anaconda3\envs\PythonCPU\python.exe`` and start a new Console to select the environment with Keras as your working one while running Spyder itself from the other one. For more details about this, see our [guide to working with packages and environments with Spyder](https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder); this will all be much easier in the forthcoming Spyder 4 release.

> ``[7668:5896:0203/203000.573:ERROR:broker_win.cc(59)] Error reading broker pipe: The pipe has been ended. (0x6D)``

This error appears to be unrelated to one one being discussed here; see the solutions e.g. #7250 , #7690 , #7599 and #4605 (disabling any security software/firewalls/antivirus, ``conda update pyqt qt``, ``conda install pyopengl``, ``conda install pyqt=5.6``, updating your graphics card driver or selecting a different one (Intel/Nvidia), changing the OpenGL mode, update your OS, uninstall "Dell Backup and Recovery"). However, you may be able to work around it by simply using the version of Spyder in ``base``, assuming that still works.




I got the same error when I ran the last line of the code below

:

```from keras.models import Sequential
from keras.layers import Dense
classifier = Sequential()

classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu', input_dim = 11))
classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu'))
classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)
```

After typing `'conda install nomkl'` in the terminal, it finally worked.
(`conda update anaconda` worked as well)

*** Before doing this, I fully re-installed anaconda.




Hi @CAM-Gerlach, please find below the list of packages installed in the PythonCPU env. 

<details>

```
(PythonCPU) C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\praveen\Anaconda3\envs\PythonCPU:
#
# Name                    Version                   Build  Channel
_tflow_select             2.2.0                     eigen
absl-py                   0.7.0                    py36_0
alabaster                 0.7.12                   py36_0
asn1crypto                0.24.0                   py36_0
astor                     0.7.1                    py36_0
astroid                   2.1.0                    py36_0
babel                     2.6.0                    py36_0
backcall                  0.1.0                    py36_0
blas                      1.0                         mkl
bleach                    3.1.0                    pypi_0    pypi
ca-certificates           2018.12.5                     0
certifi                   2018.11.29               py36_0
cffi                      1.11.5           py36h74b6da3_1
chardet                   3.0.4                    py36_1
cloudpickle               0.6.1                    py36_0
colorama                  0.4.1                    py36_0
cryptography              2.4.2            py36h7a1dbc1_0
cycler                    0.10.0           py36h009560c_0
decorator                 4.3.0                    py36_0
docutils                  0.14             py36h6012d8f_0
entrypoints               0.3                      py36_0
freetype                  2.9.1                ha9979f8_1
gast                      0.2.2                    py36_0
grpcio                    1.16.1           py36h351948d_1
h5py                      2.9.0            py36h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
idna                      2.8                      py36_0
imagesize                 1.1.0                    py36_0
intel-openmp              2019.1                      144
ipykernel                 4.10.0                   py36_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h3c5d0ee_0
isort                     4.3.4                    py36_0
jedi                      0.13.2                   py36_0
jinja2                    2.10                     py36_0
jpeg                      9b                   hb83a4c4_2
jsonschema                2.6.0            py36h7636477_0
jupyter_client            5.2.4                    py36_0
jupyter_core              4.4.0                    py36_0
keras                     2.2.4                         0
keras-applications        1.0.6                    py36_0
keras-base                2.2.4                    py36_0
keras-preprocessing       1.0.5                    py36_0
keyring                   17.1.1                   py36_0
kiwisolver                1.0.1            py36h6538335_0
lazy-object-proxy         1.3.1            py36hfa6e2cd_2
libpng                    1.6.36               h2a8f88b_0
libprotobuf               3.6.1                h7bd577a_0
libsodium                 1.0.16               h9d3ae62_0
libtiff                   4.0.10            h2929a5b_1001
markdown                  3.0.1                    py36_0
markupsafe                1.1.0            py36he774522_0
matplotlib                3.0.2            py36hc8f65d3_0
mccabe                    0.6.1                    py36_1
mistune                   0.8.4            py36he774522_0
mkl                       2019.1                      144
mkl_fft                   1.0.10           py36h14836fe_0
mkl_random                1.0.2            py36h343c172_0
nbconvert                 5.3.1                    py36_0
nbformat                  4.4.0            py36h3a5bc1b_0
numpy                     1.15.4           py36h19fb1c0_0
numpy-base                1.15.4           py36hc3f5095_0
numpydoc                  0.8.0                    py36_0
olefile                   0.46                     py36_0
openssl                   1.1.1a               he774522_0
packaging                 18.0                     py36_0
pandas                    0.24.0           py36ha925a31_0
pandoc                    2.2.3.2                       0
pandocfilters             1.4.2                    py36_1
parso                     0.3.1                    py36_0
pickleshare               0.7.5                    py36_0
pillow                    5.4.1            py36hdc69c19_0
pip                       18.1                     py36_0
prompt_toolkit            2.0.7                    py36_0
protobuf                  3.6.1            py36h33f27b4_0
psutil                    5.4.8            py36he774522_0
pycodestyle               2.4.0                    py36_0
pycparser                 2.19                     py36_0
pyflakes                  2.0.0                    py36_0
pygments                  2.3.1                    py36_0
pylint                    2.2.2                    py36_0
pyopenssl                 18.0.0                   py36_0
pyparsing                 2.3.1                    py36_0
pyqt                      5.9.2            py36h6538335_2
pyreadline                2.1                      py36_1
pysocks                   1.6.8                    py36_0
python                    3.6.8                h9f7ef89_0
python-dateutil           2.7.5                    py36_0
pytz                      2018.9                   py36_0
pywin32                   223              py36hfa6e2cd_1
pyyaml                    3.13             py36hfa6e2cd_0
pyzmq                     17.1.2           py36ha925a31_2
qt                        5.9.7            vc14h73c81de_0
qtawesome                 0.5.5                    py36_0
qtconsole                 4.4.3                    py36_0
qtpy                      1.5.2                    py36_0
requests                  2.21.0                   py36_0
rope                      0.11.0                   py36_0
scipy                     1.2.0            py36h29ff71c_0
setuptools                40.6.3                   py36_0
sip                       4.19.8           py36h6538335_0
six                       1.12.0                   py36_0
snowballstemmer           1.2.1            py36h763602f_0
sphinx                    1.8.2                    py36_0
sphinxcontrib             1.0                      py36_1
sphinxcontrib-websupport  1.1.0                    py36_1
spyder                    3.3.2                    py36_0
spyder-kernels            0.3.0                    py36_0
sqlite                    3.26.0               he774522_0
tensorboard               1.12.2           py36h33f27b4_0
tensorflow                1.12.0          eigen_py36h67ac661_0
tensorflow-base           1.12.0          eigen_py36h45df0d8_0
termcolor                 1.1.0                    py36_1
testpath                  0.4.2                    py36_0
tk                        8.6.8                hfa6e2cd_0
tornado                   5.1.1            py36hfa6e2cd_0
traitlets                 4.3.2            py36h096827d_0
typed-ast                 1.1.0            py36hfa6e2cd_0
urllib3                   1.24.1                   py36_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7            py36h3d5aa90_0
webencodings              0.5.1                    py36_1
werkzeug                  0.14.1                   py36_0
wheel                     0.32.3                   py36_0
win_inet_pton             1.0.1                    py36_1
wincertstore              0.2              py36h7fe50ca_0
wrapt                     1.11.0           py36he774522_0
yaml                      0.1.7                hc54c509_2
zeromq                    4.3.1                h33f27b4_3
zlib                      1.2.11               h62dcd97_3

(PythonCPU) C:\WINDOWS\system32>
```

</details>

Now, tried the given commands one after another and launched spyder but it failed all the time.

```
conda install --force-reinstall spyder-kernels=0

**spyder crashed**

(PythonCPU) C:\WINDOWS\system32>conda install ipykernel=4
Collecting package metadata: done
Solving environment: done

# All requested packages already installed.

`(PythonCPU) C:\WINDOWS\system32>spyder`

**spyder crashed**

(base) C:\WINDOWS\system32>conda update spyder spyder-kernels
Collecting package metadata: done
Solving environment: done

# All requested packages already installed.
```

<details>

```
(base) C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\praveen\Anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py36_0
alabaster                 0.7.12                   py36_0
anaconda-client           1.7.2                    py36_0
anaconda-navigator        1.9.6                    py36_0
anaconda-project          0.8.2                    py36_0
asn1crypto                0.24.0                   py36_0
astroid                   2.1.0                    py36_0
astropy                   3.1.1            py36he774522_0
atomicwrites              1.2.1                    py36_0
attrs                     18.2.0           py36h28b3542_0
babel                     2.6.0                    py36_0
backcall                  0.1.0                    py36_0
backports                 1.0                      py36_1
backports.os              0.1.1                    py36_0
backports.shutil_get_terminal_size 1.0.0                    py36_2
beautifulsoup4            4.7.1                    py36_1
bitarray                  0.8.3            py36hfa6e2cd_0
bkcharts                  0.2              py36h7e685f7_0
blas                      1.0                         mkl
blaze                     0.11.3                   py36_0
blosc                     1.14.4               he51fdeb_0
bokeh                     1.0.4                    py36_0
boto                      2.49.0                   py36_0
bottleneck                1.2.1            py36h452e1ab_1
bzip2                     1.0.6                hfa6e2cd_5
ca-certificates           2018.12.5                     0
certifi                   2018.11.29               py36_0
cffi                      1.11.5           py36h74b6da3_1
chardet                   3.0.4                    py36_1
click                     7.0                      py36_0
cloudpickle               0.6.1                    py36_0
clyent                    1.2.2                    py36_1
colorama                  0.4.1                    py36_0
comtypes                  1.1.7                    py36_0
conda                     4.6.2                    py36_0
conda-build               3.17.7                   py36_0
conda-env                 2.6.0                         1
conda-verify              3.1.1                    py36_0
console_shortcut          0.1.1                         3
contextlib2               0.5.5            py36he5d52c0_0
cryptography              2.4.2            py36h7a1dbc1_0
curl                      7.63.0            h2a8f88b_1000
cycler                    0.10.0           py36h009560c_0
cython                    0.29.2           py36ha925a31_0
cytoolz                   0.9.0.1          py36hfa6e2cd_1
dask                      1.0.0                    py36_0
dask-core                 1.0.0                    py36_0
datashape                 0.5.4                    py36_1
decorator                 4.3.0                    py36_0
defusedxml                0.5.0                    py36_1
distributed               1.25.2                   py36_0
docutils                  0.14             py36h6012d8f_0
entrypoints               0.3                      py36_0
et_xmlfile                1.0.1            py36h3d2d736_0
fastcache                 1.0.2            py36hfa6e2cd_2
filelock                  3.0.10                   py36_0
flask                     1.0.2                    py36_1
flask-cors                3.0.7                    py36_0
freetype                  2.9.1                ha9979f8_1
future                    0.17.1                   py36_0
get_terminal_size         1.0.0                h38e98db_0
gevent                    1.4.0            py36he774522_0
glob2                     0.6                      py36_1
greenlet                  0.4.15           py36hfa6e2cd_0
h5py                      2.8.0            py36h3bdd7fb_2
hdf5                      1.10.2               hac2f561_1
heapdict                  1.0.0                    py36_2
html5lib                  1.0.1                    py36_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
idna                      2.8                      py36_0
imageio                   2.4.1                    py36_0
imagesize                 1.1.0                    py36_0
importlib_metadata        0.7                      py36_0
intel-openmp              2019.1                      144
ipykernel                 5.1.0            py36h39e3cac_0
ipython                   7.2.0            py36h39e3cac_0
ipython_genutils          0.2.0            py36h3c5d0ee_0
ipywidgets                7.4.2                    py36_0
isort                     4.3.4                    py36_0
itsdangerous              1.1.0                    py36_0
jdcal                     1.4                      py36_0
jedi                      0.13.2                   py36_0
jinja2                    2.10                     py36_0
jpeg                      9b                   hb83a4c4_2
jsonschema                2.6.0            py36h7636477_0
jupyter                   1.0.0                    py36_7
jupyter_client            5.2.4                    py36_0
jupyter_console           6.0.0                    py36_0
jupyter_core              4.4.0                    py36_0
jupyterlab                0.35.3                   py36_0
jupyterlab_server         0.2.0                    py36_0
keyring                   17.1.1                   py36_0
kiwisolver                1.0.1            py36h6538335_0
krb5                      1.16.1               hc04afaa_7
lazy-object-proxy         1.3.1            py36hfa6e2cd_2
libarchive                3.3.3                h0643e63_5
libcurl                   7.63.0            h2a8f88b_1000
libiconv                  1.15                 h1df5818_7
libpng                    1.6.35               h2a8f88b_0
libsodium                 1.0.16               h9d3ae62_0
libssh2                   1.8.0                h7a1dbc1_4
libtiff                   4.0.9                h36446d0_2
libxml2                   2.9.8                hadb2253_1
libxslt                   1.1.32               hf6f1972_0
llvmlite                  0.27.0           py36ha925a31_0
locket                    0.2.0            py36hfed976d_1
lxml                      4.3.0            py36h1350720_0
lz4-c                     1.8.1.2              h2fa13f4_0
lzo                       2.10                 h6df0209_2
m2w64-gcc-libgfortran     5.3.0                         6
m2w64-gcc-libs            5.3.0                         7
m2w64-gcc-libs-core       5.3.0                         7
m2w64-gmp                 6.1.0                         2
m2w64-libwinpthread-git   5.0.0.4634.697f757               2
markupsafe                1.1.0            py36he774522_0
matplotlib                3.0.2            py36hc8f65d3_0
mccabe                    0.6.1                    py36_1
menuinst                  1.4.14           py36hfa6e2cd_0
mistune                   0.8.4            py36he774522_0
mkl                       2019.1                      144
mkl-service               1.1.2            py36hb782905_5
mkl_fft                   1.0.10           py36h14836fe_0
mkl_random                1.0.2            py36h343c172_0
more-itertools            5.0.0                    py36_0
mpmath                    1.1.0                    py36_0
msgpack-python            0.5.6            py36he980bc4_1
msys2-conda-epoch         20160418                      1
multipledispatch          0.6.0                    py36_0
navigator-updater         0.2.1                    py36_0
nbconvert                 5.4.0                    py36_1
nbformat                  4.4.0            py36h3a5bc1b_0
networkx                  2.2                      py36_1
nltk                      3.4                      py36_1
nose                      1.3.7                    py36_2
notebook                  5.7.4                    py36_0
numba                     0.42.0           py36hf9181ef_0
numexpr                   2.6.9            py36hdce8814_0
numpy                     1.15.4           py36h19fb1c0_0
numpy-base                1.15.4           py36hc3f5095_0
numpydoc                  0.8.0                    py36_0
odo                       0.5.1            py36h7560279_0
olefile                   0.46                     py36_0
openpyxl                  2.5.12                   py36_0
openssl                   1.1.1a               he774522_0
packaging                 18.0                     py36_0
pandas                    0.24.0           py36ha925a31_0
pandoc                    1.19.2.1             hb2460c7_1
pandocfilters             1.4.2                    py36_1
parso                     0.3.1                    py36_0
partd                     0.3.9                    py36_0
path.py                   11.5.0                   py36_0
pathlib2                  2.3.3                    py36_0
patsy                     0.5.1                    py36_0
pep8                      1.7.1                    py36_0
pickleshare               0.7.5                    py36_0
pillow                    5.4.1            py36hdc69c19_0
pip                       18.1                     py36_0
pkginfo                   1.5.0.1                  py36_0
pluggy                    0.8.1                    py36_0
ply                       3.11                     py36_0
prometheus_client         0.5.0                    py36_0
prompt_toolkit            2.0.7                    py36_0
psutil                    5.4.8            py36he774522_0
py                        1.7.0                    py36_0
pycodestyle               2.4.0                    py36_0
pycosat                   0.6.3            py36hfa6e2cd_0
pycparser                 2.19                     py36_0
pycrypto                  2.6.1            py36hfa6e2cd_9
pycurl                    7.43.0.2         py36h7a1dbc1_0
pyflakes                  2.0.0                    py36_0
pygments                  2.3.1                    py36_0
pylint                    2.2.2                    py36_0
pyodbc                    4.0.25           py36ha925a31_0
pyopenssl                 18.0.0                   py36_0
pyparsing                 2.3.1                    py36_0
pyqt                      5.9.2            py36h6538335_2
pysocks                   1.6.8                    py36_0
pytables                  3.4.4            py36he6f6034_0
pytest                    4.1.1                    py36_0
pytest-arraydiff          0.3              py36h39e3cac_0
pytest-astropy            0.5.0                    py36_0
pytest-doctestplus        0.2.0                    py36_0
pytest-openfiles          0.3.2                    py36_0
pytest-remotedata         0.3.1                    py36_0
python                    3.6.8                h9f7ef89_0
python-dateutil           2.7.5                    py36_0
python-libarchive-c       2.8                      py36_6
pytz                      2018.9                   py36_0
pywavelets                1.0.1            py36h8c2d366_0
pywin32                   223              py36hfa6e2cd_1
pywinpty                  0.5.5                 py36_1000
pyyaml                    3.13             py36hfa6e2cd_0
pyzmq                     17.1.2           py36hfa6e2cd_0
qt                        5.9.7            vc14h73c81de_0  [vc14]
qtawesome                 0.5.5                    py36_0
qtconsole                 4.4.3                    py36_0
qtpy                      1.5.2                    py36_0
requests                  2.21.0                   py36_0
rope                      0.11.0                   py36_0
ruamel_yaml               0.15.46          py36hfa6e2cd_0
scikit-image              0.14.1           py36ha925a31_0
scikit-learn              0.20.2           py36h343c172_0
scipy                     1.2.0            py36h29ff71c_0
seaborn                   0.9.0                    py36_0
send2trash                1.5.0                    py36_0
setuptools                40.6.3                   py36_0
simplegeneric             0.8.1                    py36_2
singledispatch            3.4.0.3          py36h17d0c80_0
sip                       4.19.8           py36h6538335_0
six                       1.12.0                   py36_0
snappy                    1.1.7                h777316e_3
snowballstemmer           1.2.1            py36h763602f_0
sortedcollections         1.1.2                    py36_0
sortedcontainers          2.1.0                    py36_0
soupsieve                 1.7.1                    py36_0
sphinx                    1.8.2                    py36_0
sphinxcontrib             1.0                      py36_1
sphinxcontrib-websupport  1.1.0                    py36_1
spyder                    3.3.2                    py36_0
spyder-kernels            0.3.0                    py36_0
sqlalchemy                1.2.16           py36he774522_0
sqlite                    3.26.0               he774522_0
statsmodels               0.9.0            py36h452e1ab_0
sympy                     1.3                      py36_0
tblib                     1.3.2            py36h30f5020_0
terminado                 0.8.1                    py36_1
testpath                  0.4.2                    py36_0
tk                        8.6.8                hfa6e2cd_0
toolz                     0.9.0                    py36_0
tornado                   5.1.1            py36hfa6e2cd_0
tqdm                      4.29.1                     py_0
traitlets                 4.3.2            py36h096827d_0
typed-ast                 1.1.0            py36hfa6e2cd_0
unicodecsv                0.14.1           py36h6450c06_0
urllib3                   1.24.1                   py36_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.15.26706          h3a45250_0
wcwidth                   0.1.7            py36h3d5aa90_0
webencodings              0.5.1                    py36_1
werkzeug                  0.14.1                   py36_0
wheel                     0.32.3                   py36_0
widgetsnbextension        3.4.2                    py36_0
win_inet_pton             1.0.1                    py36_1
win_unicode_console       0.5              py36hcdbd4b5_0
wincertstore              0.2              py36h7fe50ca_0
winpty                    0.4.3                         4
wrapt                     1.11.0           py36he774522_0
xlrd                      1.2.0                    py36_0
xlsxwriter                1.1.2                    py36_0
xlwings                   0.15.1                   py36_0
xlwt                      1.3.0            py36h1a4751e_0
xz                        5.2.4                h2fa13f4_4
yaml                      0.1.7                hc54c509_2
zeromq                    4.2.5                he025d50_1
zict                      0.1.3                    py36_0
zlib                      1.2.11               h62dcd97_3
zstd                      1.3.7                h508b16e_0

(base) C:\WINDOWS\system32>spyder
```
</details>


This worked fine with base env and able to launch the spyder. But since it does not contain sklearn module, it gave the below error:
`ModuleNotFoundError: No module named 'sklearn'`

I tried to follow your given link to use environments and its packages but I missed the flow some where I guess and could not able to make it work.

Finally, I tried the launch the spyder from the PythonCPU env from anaconda navigator and it launched without any issues and also am able to run the commands sucessfully:
`import keras`
and
`from keras.models import Sequential`

I will now proceed with my rest of the course and see how far I will go with this setup :)
Thanks for now to you for your patience and guidance. Cheers.

PS: I tried my best to use the single ticks and triple ticks to format the code, but not sure if it works this time. Sorry if it did not work.

> **spyder crashed**

Is this the *exact same crash* as before?



> But since it does not contain sklearn module, it gave the below error

You have ``scikit-learn`` installed in ``base``, just not ``PythonCPU``, which was presumably your working environment during that test. The solution is to install it in ``PythonCPU`` if you need to work with it, just like you did ``keras`` and your other packages.

> I tried to follow your given link to use environments and its packages but I missed the flow some where I guess and could not able to make it work.

What didn't work, specifically?

> I tried the launch the spyder from the PythonCPU env from anaconda navigator 

So it works from that environment in Anaconda Navigator, but not from Anaconda Prompt? Did you try running it from a non-admin Anaconda prompt? Sometimes Windows can give you issues running from one or the other.

> I will now proceed with my rest of the course and see how far I will go with this setup :)

Okay; let us know if you run into this issue again, and best of luck!

> I tried my best to use the single ticks and triple ticks to format the code, but not sure if it works this time. 

You can simply click the "preview" tab to see if it did, or look at your comment after posting it and edit it accordingly.

You mostly got it right, thanks, except for lacking ``<details>`` tags on the long sections not putting the middle section in a code block (and using individual backticks instead on only specific lines, while missing others). I fixed those for you again, so don't worry.

Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/client.py b/spyder/widgets/ipythonconsole/client.py
--- a/spyder/widgets/ipythonconsole/client.py
+++ b/spyder/widgets/ipythonconsole/client.py
@@ -668,9 +668,19 @@ def _hide_loading_page(self):
 
     def _read_stderr(self):
         """Read the stderr file of the kernel."""
+        # We need to read stderr_file as bytes to be able to
+        # detect its encoding with chardet
         f = open(self.stderr_file, 'rb')
+
         try:
             stderr_text = f.read()
+
+            # This is needed to avoid showing an empty error message
+            # when the kernel takes too much time to start.
+            # See issue 8581
+            if not stderr_text:
+                return ''
+
             # This is needed since the stderr file could be encoded
             # in something different to utf-8.
             # See issue 4191


Test patch: