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

Jupyter command jupyter-nbconvert not found in VS Code on Win10 #4347

Closed
Jupiter-ZZC opened this issue Jan 12, 2021 · 6 comments
Closed

Jupyter command jupyter-nbconvert not found in VS Code on Win10 #4347

Jupiter-ZZC opened this issue Jan 12, 2021 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@Jupiter-ZZC
Copy link

I was trying to export my jupyter notebook in the VS Code to html or pdf. However when I exported it, the process automatically breaked and throwed exception as Jupyter command jupyter-nbconvert not found. I have gone through version check and found that nbconvert and jupyter were installed. Therefore I dont know why the process would failed.

Environment data

  • VS Code version: 1.52.1
  • Jupyter Extension version (available under the Extensions sidebar): 6.1.4(core)
  • Python Extension version (available under the Extensions sidebar): 3.7.5
  • OS (Windows | Mac | Linux distro) and version: Win 10
  • Python and/or Anaconda version: 3.7.5

Expected behaviour

Convert the jupyter notebook to html

Actual behaviour

the process breaks

Steps to reproduce:

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

`

D:\Python\Python37\python.exe c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert c:\Users\木辛\AppData\Local\Temp\5e90ef96-fd0c-44c3-851a-72578f6922b4\Lab04-11711203.ipynb --to html --output tmp-8180nJyFVOI4wzPo.html --output-dir ~\AppData\Local\Temp --debug
D:\Python\Python37\python.exe c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert c:\Users\木辛\AppData\Local\Temp\5e90ef96-fd0c-44c3-851a-72578f6922b4\Lab04-11711203.ipynb --to html --output tmp-8180nJyFVOI4wzPo.html --output-dir ~\AppData\Local\Temp --debug
Error 2021-01-12 11:14:22: Export failed [Error: Traceback (most recent call last):
File "c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py", line 26, in
runpy.run_module(module, run_name="main", alter_sys=True)
File "D:\Python\Python37\lib\runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "D:\Python\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "D:\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter.py", line 4, in
main()
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter_core\command.py", line 247, in main
command = _jupyter_abspath(subcommand)
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter_core\command.py", line 134, in _jupyter_abspath
'Jupyter command {} not found.'.format(jupyter_subcommand)
Exception: Jupyter command jupyter-nbconvert not found.

at a.executeCommand (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:1:448888)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async a.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:253800)
at async _.exportToFormat (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:252766)
at async _.performExport (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:251809)
at async _.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:251323)
at async m.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:32:265964)]

`

@Jupiter-ZZC Jupiter-ZZC added the bug Issue identified by VS Code Team member as probable bug label Jan 12, 2021
@Jupiter-ZZC
Copy link
Author

The log in the OUTPUT panel is as followed.

`> D:\Python\Python37\python.exe c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert c:\Users\木辛\AppData\Local\Temp\5e90ef96-fd0c-44c3-851a-72578f6922b4\Lab04-11711203.ipynb --to html --output tmp-8180nJyFVOI4wzPo.html --output-dir ~\AppData\Local\Temp --debug

D:\Python\Python37\python.exe c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py jupyter nbconvert c:\Users\木辛\AppData\Local\Temp\5e90ef96-fd0c-44c3-851a-72578f6922b4\Lab04-11711203.ipynb --to html --output tmp-8180nJyFVOI4wzPo.html --output-dir ~\AppData\Local\Temp --debug
Error 2021-01-12 11:14:22: Export failed [Error: Traceback (most recent call last):
File "c:\Users\木辛.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\pythonFiles\pyvsc-run-isolated.py", line 26, in
runpy.run_module(module, run_name="main", alter_sys=True)
File "D:\Python\Python37\lib\runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "D:\Python\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "D:\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter.py", line 4, in
main()
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter_core\command.py", line 247, in main
command = _jupyter_abspath(subcommand)
File "C:\Users\木辛\AppData\Roaming\Python\Python37\site-packages\jupyter_core\command.py", line 134, in _jupyter_abspath
'Jupyter command {} not found.'.format(jupyter_subcommand)
Exception: Jupyter command jupyter-nbconvert not found.

at a.executeCommand (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:1:448888)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async a.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:253800)
at async _.exportToFormat (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:252766)
at async _.performExport (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:251809)
at async _.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:49:251323)
at async m.export (c:\Users\木辛\.vscode\extensions\ms-toolsai.jupyter-2020.12.414227025\out\client\extension.js:32:265964)]`

@IanMatthewHuff
Copy link
Member

Hey @Jupiter-ZZC Sorry about the issue here, and thanks for providing the output. I think that the first thing to check here would be to see if nbconvert (which is what our extension uses to do the conversion) can work outside of VS Code.

It looks to me like you are not using a virtual environment or conda environment so I think that from a Command Prompt window you can basically just run the following command:

D:\Python\Python37\python.exe jupyter nbconvert c:\Users\木辛\AppData\Local\Temp\5e90ef96-fd0c-44c3-851a-72578f6922b4\Lab04-11711203.ipynb --to html --output tmp-8180nJyFVOI4wzPo.html --output-dir ~\AppData\Local\Temp --debug

That Lab04-11711203.ipynb file looks like it's in a temporary location, so you can just change that name to point at any ipynb file on disk. If you do that does nbconvert run and output an html file?

@IanMatthewHuff IanMatthewHuff added the info-needed Issue requires more information from poster label Jan 12, 2021
@Jupiter-ZZC
Copy link
Author

HI! Thank you for you help @IanMatthewHuff . I have tried the command in cmd with little adjustment to make it convert a non-temporary notebook file. Yet the process failed again. Belows are the adjusted command and output in cmd.
D:\Python\Python37\python.exe jupyter nbconvert E:\ML2020\Lab04\mywork.ipynb --to html --output tryout.html --output-dir E:\ML2020 --debug Output: D:\Python\Python37\python.exe: can't open file 'jupyter': [Errno 2] No such file or directory
To me it seems like my jupyter setting or installation might have some problems. Am I right?
P.S: I also ran the python interpreter and checked the list of modules. I can find nbconvert and jupyter in that list.

@IanMatthewHuff
Copy link
Member

@Jupiter-ZZC I believe that I didn't specify that command right, you could try that again with a -m after python.exe. So python.exe -m jupyter nbconvert ....

A couple more quick things, could you get the version of nbconvert that you are working with? After pulling that you could try an uninstall and reinstall of nbconvert.

python -m pip uninstall nbconvert
python -m pip install nbconvert -U

If you have a bad version of nbconvert that might get you into a working state.

@jf20191031
Copy link

@Jupiter-ZZC

I had a similar issue. In my case the solution was to to launch powershell as administrator in order to (re)install nbconvert.
I usually use my pc from a restricted user account and so pip could not install the packages into the folder C:\Users\UserName\AppData\Roaming\Python\Python38\site-packages\ but into the folder C:\Users\UserName\AppData\Roaming\Python\Python38\Scripts\. There however it could not be found either by VS Code or python.exe.

@rchiodo rchiodo closed this as completed Feb 18, 2021
@avinashnelluri
Copy link

@Jupiter-ZZC

I had a similar issue. In my case the solution was to to launch powershell as administrator in order to (re)install nbconvert.
I usually use my pc from a restricted user account and so pip could not install the packages into the folder C:\Users\UserName\AppData\Roaming\Python\Python38\site-packages\ but into the folder C:\Users\UserName\AppData\Roaming\Python\Python38\Scripts\. There however it could not be found either by VS Code or python.exe.

Thank you @jf20191031 This resolved my issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2021
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 info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants