vscode-jupyter: Exporting a python file as a notebook does not use the kernel matching the current python

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. I am following the instruction to export my python file into a jupyter notebook.
  2. Export succeeded and I can run the file in VSCode. image
  3. However, when I open the notebook from browser, it will show Kernel error. Restarting & Disconnecting the kernel will not help. image

Here is the detailed error:

Traceback (most recent call last):
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\XXX\appdata\local\programs\python\python37\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\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\XXX\appdata\local\programs\python\python37\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\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "c:\users\XXX\appdata\local\programs\python\python37\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Actual behavior

Jupyter Notebook exported from VSCode is showing kernel error after opening in browser.

Expected behavior

It should look like normal jupyter notebook and no kernel error.

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: 2020.1.57204 image
  • VS Code version: 1.41 image
  • Setting python.jediEnabled: false image
  • Python version: 3.7.6
  • OS: Windows 10
  • Virtual environment: N/A

Developer Tools Console Output

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Thank you!

@rchiodo

You might be right. I just noticed there are two available kernel. It was just one available before.

image

Python 3 is the one that has issue. Python 3.7 works fine.

However, based on the metadata, the kernel is using python 3.7. I don’t have any issues running the same notebook in VSCode jupyter.