Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right click "Convert a Notebook to Python Script" doesn't work. #7783

Closed
2 tasks done
greazer opened this issue Oct 1, 2021 · 10 comments
Closed
2 tasks done

Right click "Convert a Notebook to Python Script" doesn't work. #7783

greazer opened this issue Oct 1, 2021 · 10 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window verification-needed Verification of issue is requested

Comments

@greazer
Copy link
Member

greazer commented Oct 1, 2021

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

  1. Open a workspace
  2. Right click on an ipynb file
  3. Choose "Convert a Notebook to a Python Script"

Fails. Here's the log from an attempt I made. Note that my default Python interpreter is not set to PythonCodingPack\python.exe. However, it IS the python that's found first based on my Windows System Path setting. Guessing that's where this is coming from.

> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Info 2021-10-01 11:55:22: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Error 2021-10-01 11:55:22: Export failed [Error: Importing notebooks requires Jupyter nbconvert to be installed.
	at g.importFromFile (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:973776)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async s.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:923161)
	at async b.exportToFormat (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:920676)
	at async b.performExport (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919861)
	at async b.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919375)
	at async g.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:37:290037)
	at async l._executeContributedCommand (c:\Users\jimg\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111612)]
Info 2021-10-01 11:55:51: Notebook Closed file:///c%3A/Users/jimg/Repos/covid-19-data-1/SampleNbsAndScripts/test4nb.ipynb

VS Code Version

Version: 1.61.0-insider (user setup) Commit: 4fbe0344a0cedaf2a04edef728c9a3f27777cc6c Date: 2021-09-29T05:38:00.706Z Electron: 13.5.0 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22468

Jupyter Extension Version

v2021.9.1001286107

Jupyter logs

See above

Coding Language and Runtime Version

No response

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

No response

@greazer greazer added bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window needs-triage labels Oct 1, 2021
@greazer greazer added this to the September 2021 Recovery milestone Oct 1, 2021
@heysujal
Copy link

heysujal commented Oct 1, 2021

hi @greazer . I want to fix this issue . I am familiar with python. Can you guide me on how to fix this issue?

@greazer
Copy link
Member Author

greazer commented Oct 1, 2021

Thanks @heysujal! Are you running into this bug?

We'd love to have some help. That being said, the work that has to be done to fix this is either in the Jupyter extension or the Python extension and possibly VS Code core (depending on the results of the investigation, which hasn't been done yet). You can take a look at the Contributing.md files in each of these repos to see how to get started, building and debugging each extension.

Also for the record, indeed the system path is what is causing PythonCodingPack\python.exe to be found and used on my machine.

@greazer
Copy link
Member Author

greazer commented Oct 1, 2021

Actually after removing access to any python.exe from my path, I'm expectedly getting the "nbconvert needs to be installed" error, but curiously it's still looking at the PythonCodingPack path. I have no idea why that would be:

Info 2021-10-01 13:00:43: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
Info 2021-10-01 13:00:43: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
Info 2021-10-01 13:00:45: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Info 2021-10-01 13:00:45: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Error 2021-10-01 13:00:45: Export failed [Error: Importing notebooks requires Jupyter nbconvert to be installed.
	at g.importFromFile (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:973776)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async s.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:923161)
	at async b.exportToFormat (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:920676)
	at async b.performExport (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919861)
	at async b.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919375)
	at async c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:269135
	at async u.waitWithStatus (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:232892)
	at async k.importNotebookOnFile (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:269058)
	at async k.listenForErrors (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:264837)
	at async l._executeContributedCommand (c:\Users\jimg\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111612)]
Info 2021-10-01 13:00:47: Process Execution: > ~\anaconda3\envs\myenv\python.exe -c "import ipykernel"
> ~\anaconda3\envs\myenv\python.exe -c "import ipykernel"
Info 2021-10-01 13:00:47: Process Execution: > ~\anaconda3\envs\myenv\python.exe -m pip list
> ~\anaconda3\envs\myenv\python.exe -m pip list
Info 2021-10-01 13:00:48: Install Missing Dependencies, Class name = E, completed in 19161ms, has a falsy return value, Return Value: undefined
Info 2021-10-01 13:00:48: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000

@DavidKutu
Copy link

Just adding my 2 cents. This works for me, it might be a python environment issue.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Oct 1, 2021

Same here, works for me too. I wouldn't label this a regression.
Its just an existing but in the code & causing it to not work for some situations.

@heysujal
Copy link

heysujal commented Oct 2, 2021

#5222 (comment)
I think this should be done.

Actually after removing access to any python.exe from my path, I'm expectedly getting the "nbconvert needs to be installed" error, but curiously it's still looking at the PythonCodingPack path. I have no idea why that would be:

Info 2021-10-01 13:00:43: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
Info 2021-10-01 13:00:43: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -c "import nbconvert"
Info 2021-10-01 13:00:45: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Info 2021-10-01 13:00:45: Process Execution: > ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
> ~\AppData\Local\Programs\PythonCodingPack\python.exe -m jupyter nbconvert --version
Error 2021-10-01 13:00:45: Export failed [Error: Importing notebooks requires Jupyter nbconvert to be installed.
	at g.importFromFile (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:973776)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async s.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:923161)
	at async b.exportToFormat (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:920676)
	at async b.performExport (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919861)
	at async b.export (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:52:919375)
	at async c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:269135
	at async u.waitWithStatus (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:232892)
	at async k.importNotebookOnFile (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:269058)
	at async k.listenForErrors (c:\Users\jimg\.vscode-insiders\extensions\ms-toolsai.jupyter-2021.9.1001286107\out\client\extension.js:90:264837)
	at async l._executeContributedCommand (c:\Users\jimg\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:111612)]
Info 2021-10-01 13:00:47: Process Execution: > ~\anaconda3\envs\myenv\python.exe -c "import ipykernel"
> ~\anaconda3\envs\myenv\python.exe -c "import ipykernel"
Info 2021-10-01 13:00:47: Process Execution: > ~\anaconda3\envs\myenv\python.exe -m pip list
> ~\anaconda3\envs\myenv\python.exe -m pip list
Info 2021-10-01 13:00:48: Install Missing Dependencies, Class name = E, completed in 19161ms, has a falsy return value, Return Value: undefined
Info 2021-10-01 13:00:48: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000

@greazer I also faced same issue then I installed jupyter , notebook , and nbconvert.
Then issue got fixed.
Now all we no to do is to give prompt to install these three packages.

if you agree on this please guide me how do I make prompts whenever user makes an ipynb file.

@rchiodo
Copy link
Contributor

rchiodo commented Oct 4, 2021

This should fix this problem:
microsoft/vscode-python#17614

@rchiodo rchiodo closed this as completed Oct 4, 2021
@rebornix rebornix added the verification-needed Verification of issue is requested label Oct 4, 2021
@greazer
Copy link
Member Author

greazer commented Oct 16, 2021

Still not working on my Macbook. The original repro was Windows, so it may be a different problem. But it's the same end result. Note that I was using the daily insiders of Python on Saturday (10/16/2021) morning. So I believe it has the above referenced change.

Info 2021-10-16 08:23:48: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert --version
> /opt/homebrew/bin/python3 -m jupyter nbconvert --version
Info 2021-10-16 08:23:48: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert --version
> /opt/homebrew/bin/python3 -m jupyter nbconvert --version
Info 2021-10-16 08:23:48: Process Execution: > /opt/homebrew/bin/python3 (daemon) -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
> /opt/homebrew/bin/python3 (daemon) -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
Info 2021-10-16 08:23:48: Python Daemon (pid: 41879): Execute rpc method exec_module in DS Daemon
Info 2021-10-16 08:23:48: Python Daemon (pid: 41879): Execute rpc method exec_module from /opt/homebrew/opt/python@3.9/bin/python3.9
Info 2021-10-16 08:23:48: Python Daemon (pid: 41879): Exec in DS Daemon jupyter with args ['nbconvert', '/var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb', '--to', 'python', '--stdout', '--template', '/var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl']
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): Starting nbconvert wirth args ['nbconvert', '/var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb', '--to', 'python', '--stdout', '--template', '/var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl']
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): Nbconvert error: No template sub-directory with name 'python' found in the following paths:
	/Users/jimgriesmer/Library/Jupyter
	/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
	/usr/local/share/jupyter
	/usr/share/jupyter
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): Failed executing an rpc method. Error: Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
    value = obj._trait_values[self.name]
KeyError: 'template_paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 54, in _decorator
    return func(self, *args, **kwargs)
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 52, in m_exec_module
    return self._execute_and_capture_output(lambda: self._convert(args))
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 106, in _execute_and_capture_output
    func()
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 52, in <lambda>
    return self._execute_and_capture_output(lambda: self._convert(args))
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 148, in _convert
    app.main()
  File "/opt/homebrew/lib/python3.9/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 361, in start
    self.convert_notebooks()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 527, in convert_notebooks
    cls = get_exporter(self.export_format)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 103, in get_exporter
    if getattr(exporter(config=config), 'enabled', True):
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 329, in __init__
    super().__init__(config=config, **kw)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 114, in __init__
    self._init_preprocessors()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 496, in _init_preprocessors
    conf = self._get_conf()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 514, in _get_conf
    for path in map(Path, self.template_paths):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
    return self.get(obj, cls)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
    default = obj.trait_defaults(self.name)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
    return self._get_trait_default_generator(names[0])(self)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
    return self.func(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 525, in _template_paths
    template_names = self.get_template_names()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 607, in get_template_names
    raise ValueError('No template sub-directory with name %r found in the following paths:\n\t%s' % (base_template, paths))
ValueError: No template sub-directory with name 'python' found in the following paths:
	/Users/jimgriesmer/Library/Jupyter
	/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
	/usr/local/share/jupyter
	/usr/share/jupyter

Warn 2021-10-16 08:23:49: Falling back to Python Execution Service due to failure in daemon [p [Error]: Failed to execute using the daemon, Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
    value = obj._trait_values[self.name]
KeyError: 'template_paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 54, in _decorator
    return func(self, *args, **kwargs)
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 52, in m_exec_module
    return self._execute_and_capture_output(lambda: self._convert(args))
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 106, in _execute_and_capture_output
    func()
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 52, in <lambda>
    return self._execute_and_capture_output(lambda: self._convert(args))
  File "/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 148, in _convert
    app.main()
  File "/opt/homebrew/lib/python3.9/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 361, in start
    self.convert_notebooks()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 527, in convert_notebooks
    cls = get_exporter(self.export_format)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 103, in get_exporter
    if getattr(exporter(config=config), 'enabled', True):
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 329, in __init__
    super().__init__(config=config, **kw)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 114, in __init__
    self._init_preprocessors()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 496, in _init_preprocessors
    conf = self._get_conf()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 514, in _get_conf
    for path in map(Path, self.template_paths):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
    return self.get(obj, cls)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
    default = obj.trait_defaults(self.name)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
    return self._get_trait_default_generator(names[0])(self)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
    return self.func(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 525, in _template_paths
    template_names = self.get_template_names()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 607, in get_template_names
    raise ValueError('No template sub-directory with name %r found in the following paths:\n\t%s' % (base_template, paths))
ValueError: No template sub-directory with name 'python' found in the following paths:
	/Users/jimgriesmer/Library/Jupyter
	/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
	/usr/local/share/jupyter
	/usr/share/jupyter

	at u.processResponse (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:38:92050)
	at u.execModuleWithDaemon (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:38:92576)
	at async u.execModule (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:38:89833)
	at async u.wrapCall (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:478660)
	at async g.importFromFile (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:977709)
	at async s.export (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:926436)
	at async b.exportToFormat (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:923885)
	at async b.performExport (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:923066)
	at async b.export (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:922568)
	at async /Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:694037
	at async u.waitWithStatus (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:657637)
	at async x.importNotebookOnFile (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:693960)
	at async x.listenForErrors (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:690163)
	at async r._executeContributedCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:111712)] {
  category: 'daemon'
}
Info 2021-10-16 08:23:49: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
> /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
Info 2021-10-16 08:23:49: Process Execution: > /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
> /opt/homebrew/bin/python3 -m jupyter nbconvert /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/d1472069-919b-4c12-98c2-878da9c51dd1/tmp-4179304cqWeY6zwqD.ipynb --to python --stdout --template /var/folders/ml/0n4d8lw134gc3_m0b9ygvtpm0000gn/T/tmp-41793z3NwAFxaDUJX.tpl
Error 2021-10-16 08:23:49: nbconvert zero size output
Error 2021-10-16 08:23:49: Export failed [Error: Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 537, in get
    value = obj._trait_values[self.name]
KeyError: 'template_paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/jupyter_core/application.py", line 264, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/config/application.py", line 846, in launch_instance
    app.start()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 361, in start
    self.convert_notebooks()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/nbconvertapp.py", line 527, in convert_notebooks
    cls = get_exporter(self.export_format)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/base.py", line 103, in get_exporter
    if getattr(exporter(config=config), 'enabled', True):
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 329, in __init__
    super().__init__(config=config, **kw)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/exporter.py", line 114, in __init__
    self._init_preprocessors()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 496, in _init_preprocessors
    conf = self._get_conf()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 514, in _get_conf
    for path in map(Path, self.template_paths):
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 577, in __get__
    return self.get(obj, cls)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 540, in get
    default = obj.trait_defaults(self.name)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 1580, in trait_defaults
    return self._get_trait_default_generator(names[0])(self)
  File "/opt/homebrew/lib/python3.9/site-packages/traitlets/traitlets.py", line 977, in __call__
    return self.func(*args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 525, in _template_paths
    template_names = self.get_template_names()
  File "/opt/homebrew/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py", line 607, in get_template_names
    raise ValueError('No template sub-directory with name %r found in the following paths:\n\t%s' % (base_template, paths))
ValueError: No template sub-directory with name 'python' found in the following paths:
	/Users/jimgriesmer/Library/Jupyter
	/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/share/jupyter
	/usr/local/share/jupyter
	/usr/share/jupyter

	at /Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:960180
	at async g.importFromFile (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:977709)
	at async s.export (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:926436)
	at async b.exportToFormat (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:923885)
	at async b.performExport (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:923066)
	at async b.export (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:66:922568)
	at async /Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:694037
	at async u.waitWithStatus (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:657637)
	at async x.importNotebookOnFile (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:693960)
	at async x.listenForErrors (/Users/jimgriesmer/.vscode-insiders/extensions/ms-toolsai.jupyter-2021.10.1001345285/out/client/extension.js:102:690163)
	at async r._executeContributedCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:94:111712)]
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): Execute rpc method ping in DS Daemon
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): Execute rpc method ping from /opt/homebrew/opt/python@3.9/bin/python3.9
Info 2021-10-16 08:23:49: Python Daemon (pid: 41879): pinged with hello

@rchiodo
Copy link
Contributor

rchiodo commented Oct 18, 2021

This should be working after Ian's change.

@greazer
Copy link
Member Author

greazer commented Oct 25, 2021

Worked for me. Didn't test thoroughly though.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug interactive-window Impacts interactive window verification-needed Verification of issue is requested
Projects
None yet
Development

No branches or pull requests

7 participants