Exporting a python file as a notebook does not use the kernel matching the current python
See original GitHub issueBug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
- I am following the instruction to export my python file into a jupyter notebook.
- Export succeeded and I can run the file in VSCode.
- However, when I open the notebook from browser, it will show Kernel error. Restarting & Disconnecting the kernel will not help.
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
- VS Code version: 1.41
- Setting python.jediEnabled: false
- 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
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (11 by maintainers)
Top Results From Across the Web
Exporting a python file as a notebook does not use the kernel ...
I am following the instruction to export my python file into a jupyter notebook. Export succeeded and I can run the file in...
Read more >Cannot open jupyter notebook in VSCode - Stack Overflow
Press Ctrl + Shift + P ; Type: Export Current Python File as Jupyter Notebook. Share.
Read more >Link your Virtual Environment to Jupyter Using Kernels
Let the prompt run and install ipykernel . We can now create Python kernels for Jupyter. Using Virtual Environments in Jupyter as Kernels....
Read more >Using at the Command Line - Jupytext documentation
Representing Jupyter notebooks as scripts requires a solid round trip conversion. You don't want your notebooks (nor your scripts) to be modified because...
Read more >Working with Jupyter Notebooks in Visual Studio Code
Next, select a kernel using the kernel picker in the top right. ... You can export a Jupyter Notebook as a Python file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you!
@rchiodo
You might be right. I just noticed there are two available kernel. It was just one available before.
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.