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

"Run Cell" codelens is not showing above marked cells in .py files #3947

Closed
gautierronan opened this issue Nov 16, 2020 · 2 comments
Closed

Comments

@gautierronan
Copy link

Environment data

  • VS Code version: 1.51.1
  • Extension version (available under the Extensions sidebar):
    -- Python: v2020.11.358366026
    -- Jupyter: v2020.11.358541065
  • OS and version: macOS Catalina 10.15.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.6
  • IPython version: 7.10.0
  • Jupyter version: 1.0.0
  • Value of the python.languageServer setting: Jedi

Expected behaviour

The CodeLens
Run Cell | Run Above | Debug Cell
above each cell marked by
#%%
should be showing but is not. It was working perfectly until a few days ago. When I opened by laptop this morning, the codelens were not showing anymore above code cells. The "Jupyter: Enable Cell Code Lens" setting is enabled in my VSCode settings. I believe that, for some reason, VSCode does not detect that there are any code cells in the .py file.

Steps to reproduce:

  1. Create a python file test.py
  2. Create a code cell
#%% This is a cell
msg = 'Hello world'
print(msg)

Python logs

> conda --version
> conda info --json
> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
Python interpreter path: /usr/local/bin/python3
Starting Jedi Python language engine.
> conda --version
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py site --user-site
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/completion.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/completion.py
Error 2020-11-16 12:20:30: stderr jediProxy Error (stderr) /Users/rgautier/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/completion.py:584: DeprecationWarning: Deprecated since version 0.16.0. Use Script(...).get_names instead.
  jedi.api.names(

> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/Code/libraries/opengrape/test.py
cwd: ~/Code
> /usr/local/bin/python3 ~/.vscode/extensions/ms-python.python-2020.11.358366026/pythonFiles/pyvsc-run-isolated.py pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode,E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107,E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118,E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241,E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611,E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003,E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303,E1304,E1305,E1306,E1310,E1700,E1701 --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text ~/Code/libraries/opengrape/test.py
cwd: ~/Code
##########Linting Output - pylint##########

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

Jupyter logs

> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py -c "import ipykernel"
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py jupyter kernelspec --version
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/vscode_datascience_helpers/getJupyterKernelspecVersion.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/vscode_datascience_helpers/getJupyterKernelspecVersion.py
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v
> /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2020.11.358541065/pythonFiles/pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_launcher_daemon -v

@gautierronan
Copy link
Author

gautierronan commented Nov 16, 2020

I figured it out. It was due to the jupyter.codeLenses setting.

For anyone who has similar issues, open your settings.json file, and replace
"jupyter.codeLenses": "python.datascience.runcell, python.datascience.runallcellsabove",
with
"jupyter.codeLenses": "jupyter.runcell, jupyter.runallcellsabove",

Apparently, the first one used to work and was replaced with the second one, but the settings were not automatically modified to take this change into account.

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Nov 17, 2020
@rchiodo
Copy link
Contributor

rchiodo commented Nov 17, 2020

This is a dupe of #1088

@rchiodo rchiodo closed this as completed Nov 17, 2020
@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
None yet
Projects
None yet
Development

No branches or pull requests

2 participants