jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.71k stars 4.95k forks source link

Error Starting Kernel / Application launch error #5586

Closed williamwebb35 closed 4 years ago

williamwebb35 commented 4 years ago

Tried the following already:

  1. Solution for issue #5282 (>conda update -c conda-forge notebook)
  2. Solution for issue #5050 (>conda install pywin32 and >pip install jupyter_client --upgrade)

Application launch error: [I 23:08:47.447 LabApp] The port 8888 is already in use, trying another port. [I 23:08:47.448 LabApp] The port 8889 is already in use, trying another port. [I 23:08:47.818 LabApp] JupyterLab extension loaded from C:\Users\sinua\anaconda3\lib\site-packages\jupyterlab [I 23:08:47.818 LabApp] JupyterLab application directory is C:\Users\sinua\anaconda3\share\jupyter\lab [I 23:08:48.170 LabApp] Serving notebooks from local directory: C:\Users\sinua [I 23:08:48.170 LabApp] The Jupyter Notebook is running at: [I 23:08:48.170 LabApp] http://localhost:8890/?token=78bc8fd60ae2fc9b67a77b9d426fe864aa4488a8d9d8a822 [I 23:08:48.170 LabApp] or http://127.0.0.1:8890/?token=78bc8fd60ae2fc9b67a77b9d426fe864aa4488a8d9d8a822 [I 23:08:48.171 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 23:08:48.348 LabApp]

To access the notebook, open this file in a browser: file:///C:/Users/sinua/AppData/Roaming/jupyter/runtime/nbserver-36072-open.html Or copy and paste one of these URLs: http://localhost:8890/?token=78bc8fd60ae2fc9b67a77b9d426fe864aa4488a8d9d8a822 or http://127.0.0.1:8890/?token=78bc8fd60ae2fc9b67a77b9d426fe864aa4488a8d9d8a822 [I 23:08:51.687 LabApp] Build is up to date [E 23:08:55.489 LabApp] Failed to run command: ['C:\Users\sinua\AppData\Local\Programs\Python\Python38\python.exe', '-m', 'ipykernel_launcher', '-f', 'C:\Users\sinua\AppData\Roaming\jupyter\runtime\kernel-4d848cf8-0d50-4577-a1b8-4eac0fe7953f.json'] PATH='C:\Users\sinua\anaconda3;C:\Users\sinua\anaconda3\Library\mingw-w64\bin;C:\Users\sinua\anaconda3\Library\usr\bin;C:\Users\sinua\anaconda3\Library\bin;C:\Users\sinua\anaconda3\Scripts;C:\Users\sinua\anaconda3\bin;C:\Users\sinua\anaconda3\condabin;C:\Users\sinua\anaconda3;C:\Users\sinua\anaconda3\Library\mingw-w64\bin;C:\Users\sinua\anaconda3\Library\usr\bin;C:\Users\sinua\anaconda3\Library\bin;C:\Users\sinua\anaconda3\Scripts;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Scripts;C:\;C:\Program Files (x86)\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\microsoft shared\Windows Live;C:\Program Files (x86)\Common Files\microsoft shared\Windows Live;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\Services\IPT;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files (x86)\Acronis\TrueImageHome;C:\Program Files (x86)\Google\Google Apps Sync;C:\Program Files (x86)\Google\Google Apps Migration;C:\Program Files (x86)\Common Files\Odbc\FileMaker;C:\Program Files\Windows Imaging;C:\Program Files\Google\Google Apps Migration;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio;C:\Users\sinua\OneDrive\Documents\Data_Science_Coding\Auto_Boring_Python;C:\Python36;C:\Python36\Scripts;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\Common Files\Acronis\VirtualFile;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64;C:\Program Files (x86)\Common Files\Acronis\FileProtector;C:\Program Files (x86)\Common Files\Acronis\FileProtector64;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Scripts;C:\;C:\Program Files (x86)\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Common Files\microsoft shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\Services\IPT;C:\Program Files (x86)\Common Files\Acronis\SnapAPI;C:\Program Files (x86)\Acronis\TrueImageHome;C:\Program Files;C:\Use' with kwargs: {'stdin': -1, 'stdout': None, 'stderr': None, 'cwd': 'C:\Users\sinua\Documents\Data_Science_Coding\Springboard\Capstone2', 'close_fds': False}

[E 23:08:55.489 LabApp] Uncaught exception POST /api/sessions?1594015735414 (::1) HTTPServerRequest(protocol='http', host='localhost:8890', method='POST', uri='/api/sessions?1594015735414', version='HTTP/1.1', remote_ip='::1') Traceback (most recent call last): File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute result = await result File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\Users\sinua\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post type=mtype)) File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\Users\sinua\anaconda3\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 "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\sinua\anaconda3\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 "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "C:\Users\sinua\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel super(MappingKernelManager, self).start_kernel(kwargs) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel km.start_kernel(kwargs) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\manager.py", line 308, in start_kernel self.kernel = self._launch_kernel(kernel_cmd, kw) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\manager.py", line 215, in _launch_kernel return launch_kernel(kernel_cmd, kw) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\launcher.py", line 135, in launch_kernel proc = Popen(cmd, *kwargs) File "C:\Users\sinua\anaconda3\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\Users\sinua\anaconda3\lib\subprocess.py", line 1207, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified [W 23:08:55.496 LabApp] Unhandled error [E 23:08:55.496 LabApp] { "Host": "localhost:8890", "Connection": "keep-alive", "Content-Length": "171", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36", "Dnt": "1", "X-Xsrftoken": "2|8c8df80e|00ac4bec55eae23968d36649068e19fe|1593617462", "Authorization": "token 78bc8fd60ae2fc9b67a77b9d426fe864aa4488a8d9d8a822", "Content-Type": "application/json", "Accept": "/*", "Origin": "http://localhost:8890", "Sec-Fetch-Site": "same-origin", "Sec-Fetch-Mode": "cors", "Sec-Fetch-Dest": "empty", "Referer": "http://localhost:8890/lab", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-US,en;q=0.9", "Cookie": "_xsrf=2|8c8df80e|00ac4bec55eae23968d36649068e19fe|1593617462; username-localhost-8888=\"2|1:0|10:1594007191|23:username-localhost-8888|44:NWUxNDQ5YmE3NjYzNDg5ODhkODE4YTJlYzc2MDU3OTY=|1c938b9105bd1080a23a8e096d797e38cd689c4eb3b4ce62a79e47269e711993\"; username-localhost-8891=\"2|1:0|10:1594011235|23:username-localhost-8891|44:YWEzZjI0MGIyNGE2NDEyNGI0YzdjNDZjNjhlZmE2Mzk=|b8aaf55c19de3e1f236b7907fc7be121d33e8ea15d298a45710231efafc9ae83\"; username-localhost-8889=\"2|1:0|10:1594014437|23:username-localhost-8889|44:MTQ4MDExNWI4NTlmNDFjNTk4NWMwNzRhNThkZjVhYjY=|6f002c393bfd522b6c85f0257f1faf92f71f614dce289218d75a6d33934b003d\"; username-localhost-8890=\"2|1:0|10:1594015735|23:username-localhost-8890|44:YWQ4OGMxOTg0NTczNDE5MWI4NGU3ODVjZTQ0OWZjZjI=|f2f68c5178614b9ad154022483ce39e3beb6d2585fea413acc9780389ccdb4fd\"" } [E 23:08:55.496 LabApp] 500 POST /api/sessions?1594015735414 (::1) 78.79ms referer=http://localhost:8890/lab

Error starting kernel: Traceback (most recent call last): File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute result = await result File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\Users\sinua\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post type=mtype)) File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\Users\sinua\anaconda3\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 "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\sinua\anaconda3\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 "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\Users\sinua\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "C:\Users\sinua\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel super(MappingKernelManager, self).start_kernel(kwargs) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel km.start_kernel(kwargs) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\manager.py", line 308, in start_kernel self.kernel = self._launch_kernel(kernel_cmd, kw) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\manager.py", line 215, in _launch_kernel return launch_kernel(kernel_cmd, kw) File "C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\launcher.py", line 135, in launch_kernel proc = Popen(cmd, **kwargs) File "C:\Users\sinua\anaconda3\lib\subprocess.py", line 800, in init restore_signals, start_new_session) File "C:\Users\sinua\anaconda3\lib\subprocess.py", line 1207, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

kevin-bates commented 4 years ago

Hi @williamwebb35 - I think your issue might better resemble #5415. Please confirm.

williamwebb35 commented 4 years ago

Yes, this problem started after downgrading from python 3.8 to python 3.7. There is a bug in 3.8 that causes problems with unpickling. I tried the following:

  1. in Anaconda prompt:

    jupyter kernelspec list Available kernels: python3 C:\Users\sinua\AppData\Roaming\jupyter\kernels\python3

  2. Located the .json: In 'kernel.json' I changed: { "argv": [ "C:\Users\sinua\AppData\Local\Programs\Python\Python38\python.exe", to: { "argv": [ "C:\Users\sinua\AppData\Roaming\jupyter\kernels\python3",

  3. I also tried: { "argv": [ "C:\Users\sinua\AppData\Roaming\jupyter\kernels\python3.exe",

  4. Rebooted entire system and the problem persists.

kevin-bates commented 4 years ago

jupyter kernelspec list Available kernels: python3 C:\Users\sinua\AppData\Roaming\jupyter\kernels\python3

The second field produced is a directory name containing a kernel.json file - as you have noticed. However, the argv stanza is the actual command that will be invoked when a python3 kernel is launched. Changing the first portion (i.e., the python executable) to the directory name (item 2) or the directory name with a ".exe" extension isn't sufficient. Both of those adjustments will yield 'file not found' or similar issues.

Please locate the python.exe file that is relative to your 3.7 env and set the first item of the argv to that fully-qualified path.

williamwebb35 commented 4 years ago

Thanks for helping, Kevin. Based on my current understanding, I modified 'kernel.json' (below). I interpreted your previous comment to mean I should include the full path to the python executable in 'kernel.json' rather than just the directory path. After doing so, Jupyter loads still without a kernel but this time does not produce an error message.

{ "argv": [ "C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe", "-m", "ipykernel_launcher", "-f", "{connection_file}" ], "display_name": "Python 3", "language": "python" }

kevin-bates commented 4 years ago

Ok, that all looks correct - so let's assume some progress has been made. Could you please do the following...

  1. Launch notebook with DEBUG enabled: jupyter notebook --debug (followed by any other options you normally set).
  2. Open a notebook and execute a simple cell.
  3. Provide the entire output of the your Notebook server console window from startup to current. We should see some output relative to the kernel's startup and operation with DEBUG enabled.

Thanks.

williamwebb35 commented 4 years ago

OK, thanks. Here is the Anaconda Prompt console output after > jupyter notebook -- debug I also attached a screenshot from jupyter notebook, just in case.

[C 13:53:42.839 NotebookApp]

To access the notebook, open this file in a browser:
    file:///C:/Users/sinua/AppData/Roaming/jupyter/runtime/nbserver-74328-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=8ab6c2ce59209889488e9114cdae03736e0f7040ee870548
 or http://127.0.0.1:8888/?token=8ab6c2ce59209889488e9114cdae03736e0f7040ee870548

[I 13:54:37.716 NotebookApp] Kernel started: 01c144c3-254d-49c5-897c-5c53f82c0512 C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe: No module named ipykernel_launcher [I 13:54:40.703 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports C:\Users\sinua\anaconda3\lib\site-packages\jupyter_client\manager.py:358: FutureWarning: Method cleanup(connection_file=True) is deprecated, use cleanup_resources(restart=False). FutureWarning) C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe: No module named ipykernel_launcher [I 13:54:43.730 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe: No module named ipykernel_launcher [I 13:54:46.731 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe: No module named ipykernel_launcher [I 13:54:50.189 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports C:\Users\sinua\AppData\Local\Programs\Python\Python37\python.exe: No module named ipykernel_launcher [W 13:54:53.207 NotebookApp] KernelRestarter: restart failed [W 13:54:53.207 NotebookApp] Kernel 01c144c3-254d-49c5-897c-5c53f82c0512 died, removing from map. [W 13:55:37.809 NotebookApp] Timeout waiting for kernel_info reply from 01c144c3-254d-49c5-897c-5c53f82c0512 [E 13:55:37.810 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 01c144c3-254d-49c5-897c-5c53f82c0512) [W 13:55:38.835 NotebookApp] 404 GET /api/kernels/01c144c3-254d-49c5-897c-5c53f82c0512/channels?session_id=146d43b2a3604ea28db095fccee30a1a (::1): Kernel does not exist: 01c144c3-254d-49c5-897c-5c53f82c0512 [W 13:55:38.858 NotebookApp] 404 GET /api/kernels/01c144c3-254d-49c5-897c-5c53f82c0512/channels?session_id=146d43b2a3604ea28db095fccee30a1a (::1) 24.93ms referer=None [W 13:55:40.870 NotebookApp] Replacing stale connection: 01c144c3-254d-49c5-897c-5c53f82c0512:146d43b2a3604ea28db095fccee30a1a [I 13:56:37.567 NotebookApp] Saving file at /Documents/Data_Science_Coding/Springboard/Capstone2/Untitled1.ipynb

Jupyter_debugging_screenshot

kevin-bates commented 4 years ago

Thanks. So it is now unable to find the ipykernel_launcher - which is part of the ipykernel package. I would install (or reinstall) ipykernel into this 3.7 env. Just validate the kernel.json via this exercise after its installed.

williamwebb35 commented 4 years ago
  1. From the windows command prompt: C:\Users\sinua>python -m pip install ipykernel
  2. From the Anaconda prompt: C:\Users\sinua>jupyter notebbok --debug
  3. Jupyter notebook runs as expected
  4. Re-started Anaconda Navigator and Jupyter Lab, which runs as expected with python 3.7.8 Jupyter_Issue_Solved_Screenshot

Thanks Kevin, what a huge relief!

kevin-bates commented 4 years ago

Awesome - glad you're moving forward! Closing issue.