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

Bash command rendered as error in revamped notebook #4554

Closed
marcusturewicz opened this issue Jan 29, 2021 · 2 comments
Closed

Bash command rendered as error in revamped notebook #4554

marcusturewicz opened this issue Jan 29, 2021 · 2 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@marcusturewicz
Copy link

marcusturewicz commented Jan 29, 2021

Environment data

  • VS Code version: 1.53.0-insider (user setup)
  • Jupyter Extension version (available under the Extensions sidebar): v2020.12.414227025
  • Python Extension version (available under the Extensions sidebar): v2021.2.518958983-dev
  • OS (Windows | Mac | Linux distro) and version: Windows_NT x64 10.0.19041
  • Python and/or Anaconda version: Python 3.7.6 Anaconda 4.8.3
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jupyter server running: Remote, I think. Connected to VM in AWS using Remote SSH extension

Expected behaviour

Cell with bash commands should be rendered without errors.

Actual behaviour

Cell with bash command is rendered as though it is an error:

image

I'm also using Pylance extension, with may be trying to interpret it as Python code:

image

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create a new Hupyter notebook
  2. Add the following to a cell: ! mkdir -p results
  3. See red squiggle line under exclamation point

Logs

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

User belongs to experiment group 'NativeNotebookEditor'
Error 2021-01-28 22:58:45: Jupyter Kernel Spec not found for a local connection
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon -v
> ~/anaconda3/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Error 2021-01-28 23:04:04: Jupyter Kernel Spec not found for a local connection
> ~/anaconda3/envs/tensorflow2_latest_p37/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
Started kernel Python 3.7.6 64-bit ('tensorflow2_latest_p37': conda)
> ~/anaconda3/envs/tensorflow2_latest_p37/bin/python ~/.vscode-server-insiders/extensions/ms-toolsai.jupyter-2020.12.414227025/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v

@marcusturewicz marcusturewicz added the bug Issue identified by VS Code Team member as probable bug label Jan 29, 2021
@DonJayamanne
Copy link
Contributor

Should we instead detect such magic commands and proactively change the language of the cell.
Something I prototyped some time ago is:

  • If we have magic commands such as %%sh or %%javascript, then change the langauge of the cell to reflect the language as prescribed by the magic (in this case, change to bash or javascript)
  • If we have a single liner that starts with !, then this agains is a bash command an we can change the language of the cell again.

This way users get the right syntax highlighting & the appropriate intellisense for the corresponding language as well.

Other examples include %%html, %%svg, etc.

@greazer
Copy link
Member

greazer commented Feb 3, 2021

Thanks for the feedback! The PyLance team is planning on supporting understanding metrics. This is not something that we would fix in our extension.

@greazer greazer closed this as completed Feb 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 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
Projects
None yet
Development

No branches or pull requests

3 participants