'Jupyter notebook shows FileNotFoundError and is unable to run any shell

I have installed Jupyter:

OS : 32bit windows 7

jupyter notebook version is 6.0.1.

After installing it, when I try to open a notebook, it shows a kernel error:

Traceback (most recent call last):
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\web.py", line 1703, in _execute
    result = await result
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "E:\Jupyter\miniconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "E:\Jupyter\miniconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "E:\Jupyter\miniconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "E:\Jupyter\miniconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "E:\Jupyter\miniconda3\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "E:\Jupyter\miniconda3\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "E:\Jupyter\miniconda3\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "E:\Jupyter\miniconda3\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "E:\Jupyter\miniconda3\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Because of this I can't use Jupyter to run anything. How to fix it?



Solution 1:[1]

This is a problem with your environment. Here's how you debug it:

Check whether the kernel specified in Jupyter config (see %APPDATA%\jupyter\kernels\<kernel_name>\kernel.json / ~/.local/share/jupyter/kernels/<kernel_name>/kernel.json on Linux) is launchable via the command line.

E.g. in my kernel.json file, there is:

{
 "argv": [
  "/home/mrmino/.virtualenvs/taf/bin/python3.7",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

Therefore, on my system, the command /home/mrmino/.virtualenvs/taf/bin/python3.7 -m ipykernel_launcher should start ipython kernel.

If on yours it does not, you have to install it or manually correct it in the JSON kernelspec file.

Solution 2:[2]

Try this, it worked for me.

python3 -m ipykernel install --user

ref: https://github.com/jupyter/notebook/issues/2563

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2