0

I recently uninstalled Anaconda3 and reinstalled Anaconda on Python 2. Following this, it seems that I cannot get a kernel running when I work with jupyter notebooks. I get this kernel error on any notebook that I tried to open:

Failed to start kernel

Traceback (most recent call last): File "C:\Users\Ejer\Anaconda2\lib\site-packages\notebook\base\handlers.py", line 516, in wrapper result = yield gen.maybe_future(method(self, *args, **kwargs)) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1055, in run value = future.result() File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1063, in run yielded = self.gen.throw(*exc_info) File "C:\Users\Ejer\Anaconda2\lib\site-packages\notebook\services\sessions\handlers.py", line 75, in post type=mtype)) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1055, in run value = future.result() File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1063, in run yielded = self.gen.throw(*exc_info) File "C:\Users\Ejer\Anaconda2\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\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1055, in run value = future.result() File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1063, in run yielded = self.gen.throw(*exc_info) File "C:\Users\Ejer\Anaconda2\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\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 1055, in run value = future.result() File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "C:\Users\Ejer\Anaconda2\lib\site-packages\tornado\gen.py", line 307, in wrapper yielded = next(result) File "C:\Users\Ejer\Anaconda2\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 94, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "C:\Users\Ejer\Anaconda2\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "C:\Users\Ejer\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 257, in start_kernel **kw) File "C:\Users\Ejer\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 203, in _launch_kernel return launch_kernel(kernel_cmd, **kw) File "C:\Users\Ejer\Anaconda2\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel proc = Popen(cmd, **kwargs) File "C:\Users\Ejer\Anaconda2\lib\subprocess.py", line 390, in __init__ errread, errwrite) File "C:\Users\Ejer\Anaconda2\lib\subprocess.py", line 640, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified 
1
  • I think this may be a good indicator that you should be using virtual environments if there is a possibility you are going to be using Python 2 and 3 on the same machine. This will allow you to isolate your dependencies. You can install Anaconda3 for example and use 'conda' to create a virtual environment that uses Python 2. conda.io/docs/user-guide/tasks/manage-environments.html Commented Jan 19, 2018 at 22:58

2 Answers 2

1

This might be because juypter is unable to find python.

Try looking in share/jupyter/kernels//kernel.json in your anaconda installation, you will see something like this.

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

make sure that the python path under argv is correct.

Sign up to request clarification or add additional context in comments.

2 Comments

I'm having a similar error exclusively for the Python 2 kernel in Jupyter Notebook, using Anaconda 3. I find that the json file you refer to above is in \kernels\python3, and that the python.exe file is in its proper location "C:/Users/me/anaconda3\\python.exe". However, there is no \python2 folder next to \python3 in Jupyter's kernel folder. And, in the anaconda installation folder, I only see supporting files for Python 3, not for Python 2. How do I install Python 2 in Anaconda 3 so that Jupyter Notebook will run the Python 2 kernel from the base rather than from an env?
Here's a link to my question: stackoverflow.com/questions/61161317/…
0

you mean you uninstalled python 3 and installed python2? Assuming this is what you did right click on anacona prompt and run as administrator try running this after running command prompt in admin mode

python2 -m pip install ipykernel 

or

python2 -m ipykernel install --user 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.