question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exporting notebooks to script requires Jupyter nbconvert but users is not prompted to do so.

See original GitHub issue

Environment data

  • VS Code version: 1.53.3
  • Jupyter Extension version (available under the Extensions sidebar): v2021.3.619093157
  • Python Extension version (available under the Extensions sidebar): v2021.3.658691958
  • OS (Windows | Mac | Linux distro) and version: Win20H2
  • Python and/or Anaconda version: 3.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): venv
  • Jupyter server running: Local

Repro steps:

  1. Have venv with jupyter and tensorflow
  2. Navigate to the folder with venv in terminal, launch code .
  3. Open saved .ipynb file (opens with correct venv python
  4. Select “Convert a Notebook to Python Script”

Expected behaviour

Works

Actual behaviour

Fails with:

User belongs to experiment group 'jupyterTestcf'
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py pip list
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py jupyter kernelspec --version
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
Error 2021-03-20 01:26:58: Jupyter Kernel Spec not found for a local connection
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3.8.2 64-bit ('venv')
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import ipykernel"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py -c "import nbconvert"
> c:\Users\houskape\source\repos\NDN4-playground\venv\Scripts\python.exe c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert --version
Error 2021-03-20 01:27:03: Export failed Error: Importing notebooks requires Jupyter nbconvert to be installed.
    at g.importFromFile (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:492139)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at s.export (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:260294)
    at _.exportToFormat (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:257809)
    at _.performExport (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:256994)
    at _.export (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:256508)
    at c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:418329
    at u.waitWithStatus (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:828995)
    at E.importNotebook (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:418249)
    at E.listenForErrors (c:\Users\houskape\.vscode\extensions\ms-toolsai.jupyter-2021.3.619093157\out\client\extension.js:49:414146)
    at S._executeContributedCommand (c:\Users\houskape\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:87:103766)

while nbconvert is installed in active venv:

PS C:\Users\houskape\source\repos\NDN4-playground> & c:/Users/houskape/source/repos/NDN4-playground/venv/Scripts/Activate.ps1
(venv) PS C:\Users\houskape\source\repos\NDN4-playground> python -m pip install "nbconvert"
Requirement already satisfied: nbconvert in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (6.0.7)
Requirement already satisfied: mistune<2,>=0.8.1 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.8.4)
Requirement already satisfied: pygments>=2.4.1 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (2.7.2)    
Requirement already satisfied: jupyterlab-pygments in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.1.2)
Requirement already satisfied: bleach in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (3.2.1)
Requirement already satisfied: jupyter-core in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (4.7.0)
Requirement already satisfied: nbformat>=4.4 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (5.0.8)
Requirement already satisfied: defusedxml in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.6.0)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.5.1)
Requirement already satisfied: testpath in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.4.4)
Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (1.4.3)
Requirement already satisfied: jinja2>=2.4 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (2.11.2)
Requirement already satisfied: traitlets>=4.2 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (5.0.5)
Requirement already satisfied: entrypoints>=0.2.2 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbconvert) (0.3)
Requirement already satisfied: webencodings in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from bleach->nbconvert) (0.5.1)
Requirement already satisfied: six>=1.9.0 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from bleach->nbconvert) (1.15.0)
Requirement already satisfied: packaging in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from bleach->nbconvert) (20.5)
Requirement already satisfied: pywin32>=1.0; sys_platform == "win32" in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jupyter-core->nbconvert) (300)
Requirement already satisfied: ipython-genutils in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbformat>=4.4->nbconvert) (0.2.0)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbformat>=4.4->nbconvert) (3.2.0)
Requirement already satisfied: async-generator in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert) (1.10)
Requirement already satisfied: jupyter-client>=6.1.5 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert) (6.1.7)
Requirement already satisfied: nest-asyncio in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert) (1.4.3)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jinja2>=2.4->nbconvert) (1.1.1)
Requirement already satisfied: pyparsing>=2.0.2 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from packaging->bleach->nbconvert) (2.4.7)
Requirement already satisfied: setuptools in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4->nbconvert) (41.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4->nbconvert) (0.17.3)
Requirement already satisfied: attrs>=17.4.0 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.4->nbconvert) (20.3.0)
Requirement already satisfied: pyzmq>=13 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jupyter-client>=6.1.5->nbclient<0.6.0,>=0.5.0->nbconvert) (20.0.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jupyter-client>=6.1.5->nbclient<0.6.0,>=0.5.0->nbconvert) (2.8.1)
Requirement already satisfied: tornado>=4.1 in c:\users\houskape\source\repos\ndn4-playground\venv\lib\site-packages (from jupyter-client>=6.1.5->nbclient<0.6.0,>=0.5.0->nbconvert) (6.1)
WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(venv) PS C:\Users\houskape\source\repos\NDN4-playground> 

Correct interpreter is selected: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:32 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidKutucommented, Aug 31, 2021

Sorry for the late response and thanks everyone for commenting your solutions. From what I’m reading, we should prompt users to install missing dependencies (nbconvert, notebook, jupyter).

@rikkigouda, @juanbomfim22, @autoscraper and @petrroll, does this solve your issue?

1reaction
greazercommented, Jul 29, 2021

We need to understand why this is failing for some people. We need at minimum to add some logging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Importing notebooks requires Jupyter nbconvert to be ...
Try making sure that nbconvert is installed into that interpreter / environment. That location should be the fallback location for import and ...
Read more >
Configuration options — nbconvert 7.2.7 documentation
Answer yes to any questions instead of prompting. Long Form: {'JupyterApp': {'answer_yes': True}}. execute. Execute the notebook prior to export. Long ...
Read more >
nbconvert Documentation - Read the Docs
Using nbconvert enables: • presentation of information in familiar formats, such as PDF. • publishing of research using LaTeX and opens the ...
Read more >
ArcGIS Notebooks in ArcGIS Pro (2.8) FAQ - Esri Community
you can also use the Jupyter command nbconvert from the command prompt, or you can run the command directly from your notebook by...
Read more >
Working with Jupyter code cells in the Python Interactive window
After exporting the contents, VS Code displays a prompt through which you can open the notebook in a browser. Was this documentation helpful?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found