notebook: Kernal Error - FileNotFoundError: [WinError 2] The system cannot find the file specified

When I create a new env in Anaconda: conda create -n envname python=3.6

Then I install jupyter notebook: conda install jupyter notebook

When I start the jupyter notebook and create a new python3 I get the following Error:

Traceback (most recent call last):
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\web.py", line 1592, in _execute
    result = yield result
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
    value = future.result()
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 326, in wrapper
    yielded = next(result)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

And this is the error message in the Anaconda prompt:

Failed to run command:
    ['C:/Users/ErfanNariman/Anaconda3/envs/blockchain_coney/bin/python', '-m', 'ipykernel_launcher', '-f', 'C:\\Users\\ErfanNariman\\AppData\\Roaming\\jupyter\\runtime\\kernel-6f106cea-2eb2-4a55-a46c-6265ce62c9ae.json']
        PATH='C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Library\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Library\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Library\\mingw-w64\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Library\\usr\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Library\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\Scripts;C:\\Users\\ErfanNariman\\Anaconda3\\envs\\blockchain_coney\\bin;C:\\Users\\ErfanNariman\\Anaconda3;C:\\Users\\ErfanNariman\\Anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\Library\\usr\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\Library\\bin;C:\\Users\\ErfanNariman\\Anaconda3\\Scripts;C:\\Users\\ErfanNariman\\Anaconda3\\bin;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\iCLS\\;C:\\Program Files\\ImageMagick-6.9.10-Q8;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Program Files\\IBM\\SPSS\\Statistics\\24\\JRE\\bin;C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\DTS\\Binn\\;C:\\Program Files (x86)\\Microsoft SQL Server\\140\\Tools\\Binn\\ManagementStudio\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\140\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\140\\DTS\\Binn\\;C:\\Program Files\\PuTTY\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python37\\Scripts\\;C:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python37\\;C:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python37-32\\Scripts\\;C:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python37-32\\;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Users\\ErfanNariman\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\ErfanNariman\\AppData\\Local\\atom\\bin;C:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python36\\Scripts;C:\\Python34\\ScriptsC:\\Users\\ErfanNariman\\AppData\\Local\\Programs\\Python\\Python3'
        with kwargs:
    {'stdin': -1, 'stdout': None, 'stderr': None, 'cwd': 'C:\\Users\\ErfanNariman\\OneDrive - Coney\\Coney\\Projecten\\Blockchain Reader\\Jupyter Notebooks'}

[E 16:08:41.913 NotebookApp] Uncaught exception POST /api/sessions (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions', version='HTTP/1.1', remote_ip='::1')
    Traceback (most recent call last):
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\web.py", line 1592, in _execute
        result = yield result
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
        value = future.result()
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
        type=mtype))
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
        value = future.result()
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
        kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
        value = future.result()
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1141, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
        self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 1133, in run
        value = future.result()
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\tornado\gen.py", line 326, in wrapper
        yielded = next(result)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
        super(MappingKernelManager, self).start_kernel(**kwargs)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
        km.start_kernel(**kwargs)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
        **kw)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\subprocess.py", line 709, in __init__
        restore_signals, start_new_session)
      File "C:\Users\ErfanNariman\Anaconda3\envs\blockchain_coney\lib\subprocess.py", line 997, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified
[W 16:08:41.935 NotebookApp] Unhandled error
[E 16:08:41.941 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Content-Length": "110",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "Origin": "http://localhost:8888",
      "X-Requested-With": "XMLHttpRequest",
      "X-Xsrftoken": "2|f2baeb02|309bac39d88ac348715520f8169c964a|1537110697",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
      "Content-Type": "application/json",
      "Referer": "http://localhost:8888/notebooks/Jupyter%20Notebooks/Untitled1.ipynb?kernel_name=python3",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-US,en;q=0.9,nl;q=0.8",
      "Cookie": "_xsrf=2|f2baeb02|309bac39d88ac348715520f8169c964a|1537110697; username-localhost-8889=\"2|1:0|10:1537622338|23:username-localhost-8889|44:ZDQ1MTEyNmY5MTVkNGI3ZmI1YzYzNTE0YjgxOWFlYmU=|cf192a93498919bb4ff15eb3cec7cdf059bf955113ad75a59b38e26a158332a4\"; username-localhost-8888=\"2|1:0|10:1539007711|23:username-localhost-8888|44:YWIzYjgwMGI4M2EwNGI4MzkzYmEwMWY5M2YzZTk2MmY=|1b9a5c3e539d8879ec0a16620fc1332ff37ee906a6fa7caca69496db9a1c97e0\""
```

Does anyone know how I can fix this?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 36 (1 by maintainers)

Most upvoted comments

For anyone interested, I found the solution:

  1. Open your Anaconda Prompt.
  2. Activate your env (this step is optional if you dont work with envs)
  3. run: python -m ipykernel install --user
  4. Start your jupyter notebook

I found a solution to solve this problem. follow the steps bellow:

go to directory: /python/share/jupyter/kernels/ open the file “kernel.json”, and set the “argv”: the python path for example.

{ “argv”: [ “C:\Anaconda3\python.exe”, “-m”, “ipykernel_launcher”, “-f”, “{connection_file}” ], “display_name”: “Python 3”, “language”: “python” }

launch jupyter notebook. Everything is fine now.

I had the same issue in a conda environment that was using a different version of Python (Python 3.6.6) than the base (Python 3.7.0) environment. Running python -m ipykernel install --user did solve the issue.

Using Miniconda3 for the first time today and got the exact same issue.

python -m ipykernel install --user

fixed for me.

open the file “kernel.json”, and set the “argv”: the python path for example.

Yeah thanks, this fixed it for me. I had never touched this file manually before, but noticed that there was an extra bin folder there, if I correct the path it works.

  • "C:/bin/Miniconda3/bin/python" doesn’t work
  • "C:/bin/Miniconda3/python" works

Wonder how this path was wrongly set though.

jupyter                   1.0.0                      py_1    conda-forge
jupyter_client            5.2.3                      py_1    conda-forge
jupyter_console           6.0.0                      py_0    conda-forge
jupyter_core              4.4.0                      py_0    conda-forge

I found a solution to solve this problem. follow the steps bellow:

go to directory: /python/share/jupyter/kernels/ open the file “kernel.json”, and set the “argv”: the python path for example.

{ “argv”: [ “C:\Anaconda3\python.exe”, “-m”, “ipykernel_launcher”, “-f”, “{connection_file}” ], “display_name”: “Python 3”, “language”: “python” }

launch jupyter notebook. Everything is fine now.

It Worked. Thanks…!!

@hdavid16 I tried this and changed my kernel.json

{
 "argv": [
  // "E:/Jupyter/miniconda3/envs/axat/bin/python",
  "E:/Jupyter/miniconda3/envs/axat/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

but now i got this new error :

Traceback (most recent call last):
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\web.py", line 1703, in _execute
    result = await result
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\manager.py", line 246, in start_kernel
    kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\manager.py", line 170, in format_kernel_cmd
    cmd = self.kernel_spec.argv + extra_arguments
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\manager.py", line 82, in kernel_spec
    self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\kernelspec.py", line 238, in get_kernel_spec
    return self._get_kernel_spec_by_name(kernel_name, resource_dir)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\kernelspec.py", line 201, in _get_kernel_spec_by_name
    return self.kernel_spec_class.from_resource_dir(resource_dir)
  File "E:\Jupyter\miniconda3\envs\axat\lib\site-packages\jupyter_client\kernelspec.py", line 47, in from_resource_dir
    kernel_dict = json.load(f)
  File "E:\Jupyter\miniconda3\envs\axat\lib\json\__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "E:\Jupyter\miniconda3\envs\axat\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "E:\Jupyter\miniconda3\envs\axat\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "E:\Jupyter\miniconda3\envs\axat\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 3 column 3 (char 15)

I really appreciate if someone can help me. Thank you 😃

Edit

I just deleted the comment part and it worked for me. @hdavid16 thanx for the help.

For anyone facing this issue like this error FileNotFoundError: [WinError 2] The system cannot find the file specified

This works on Windows : python -m ipykernel install --user

Hi Everyone,

In case someone still have this problem, I solved this issue with the below

  1. Start a prompt
  2. Activate the environment
  3. Run python -m ipykernel install --user
  4. Run jupyter notebook

Python = 3.9.1 / Jupyter Lab 3.0.7

Now everything works smoothly