title: Why am I getting "An error ocurred while starting the kernel" in Spyder while running Python?
body: <p>I have installed Anaconda (python 3.7) in my Windows 8.1 system. However, while running my Python code from the Spyder console, I am getting the following error:</p>
  <p><code>An error occurred while starting the kernel</code></p>
  <p>I have checked the PATH environment variable and everything is correct.</p>
  <p>Here is the detailed error received in the console while trying to execute the code:</p>
  <blockquote>
  <p>Traceback (most recent call last):</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py&quot;, line 1572, in create_kernel_manager_and_kernel_client</p>
  <p>kernel_manager.start_kernel(stderr=stderr_handle)</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py&quot;, line 240, in start_kernel</p>
  <p>self.write_connection_file()</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py&quot;,
  line 547, in write_connection_file</p>
  <p>kernel_name=self.kernel_name</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py&quot;,
  line 212, in write_connection_file</p>
  <p>with secure_write(fname) as f:</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\contextlib.py&quot;, line 112, in <strong>enter</strong></p>
  <p>return next(self.gen)</p>
  <p>File &quot;C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py&quot;, line 102, in secure_write</p>
  <p>with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:</p>
  <p>PermissionError: [Errno 13] Permission denied: 'C:\Users\bharat\AppData\Roaming\jupyter\runtime\kernelbcba4480cd.json'</p>
  </blockquote>