I can use the normal F2 rename variable functionality in regular python files in vscode. But not when editing python in a jupyter notebook.
When I press F2 on a variable in a jupyter notebook in vscode I get the familiar change variable window but when I press enter the variable is not changed and I get this error message:
No result. No result.
Is there a way to get the F2 change variable functionality to work in jupyter notebooks?
Here's my system info:
jupyter module version
(adventofcode) C:\git\leetcode>pip show jupyter
Name: jupyter
Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter#googlegroups.org
License: BSD
Location: c:\users\johan\anaconda3\envs\adventofcode\lib\site-packages
Requires: ipykernel, qtconsole, nbconvert, jupyter-console, notebook, ipywidgets
Required-by:
Python version:
(adventofcode) C:\git\leetcode>python --version
Python 3.10.0
vscode version:
1.63.2 (user setup)
vscode Jupyter extension version (from the changelog in the extensions window):
2021.11.100 (November Release on 8 December 2021)
Notice that you put up a bug report in GitHub and see this issue: Renaming variables didn't work, the programmer replied:
Some language features are currently not supported in notebooks, but
we are making plans now to hopefully bring more of those online soon.
So please wait for this feature.
I am able to rename variables in one cell by:
Select the variable
Right click and choose "Change All Occurrences"
Change the variable name
Ctrl + F2 ~ Change All Occurrences
Related
System: MacOSX 10.15,
VSCode Version: 1.67.2,
Python Kernel Version: 3.8.13 (Conda base).
I created a new Jupyter notebook in my VSCode using command shortcut and selected the right python kernel showed above. The empty notebook page is well loaded and no error message occurred.
But when I typed and ran any code in the cell, this error message showed up below the cell.
Then I clicked the "log" link and the error log showed up and it was like this:
And hence I couldn't run any code in the notebook cell. Then I changed to another Python Kernel (3.9.12) of the same notebook, it showed the same error message:
Please give me a solution to overcome this bug.
Update: I tried to reinstall pyzmq to an older version in the canda base environment and it didn't change anything. Then I typed command jupyter --version and everything is well installed.
Update: I have searched on Github Issues of VSCode. There are two similar issues that are all caused by some extensions, one is called "Gitduck"(now renamed "duckly"), the other is "nur.Script". The link to these issues are here:
Cannot read property 'makeSettings' of undefined #834
Cannot read property 'makeSettings' of undefined #128458
But unfortunately, I never have installed any of these extensions in my VSCode. So it may be caused by a similar extension but I still don't know the name.
Finally, I use the command code --list-extensions to list all my installed extensions here, maybe helpful for filtering which extension is the bad guy:
Final Update: Today (05/31) I opened VSCode and tentatively created an empty Jupyter notebook, and this problem has gone away. I have done nothing, maybe VSCode's auto-update has solved this problem. Case closed.
You can try reinstalling the pyzmq module.
pip uninstall pyzmq
pip install pyzmq==19.0.2
Hope this helps you.
TLDR version: How to make JupyterLab Autocomplete case insensitive?
I would like to have Visual Studio Code style Intellisesne(prediction and auto complete) in jupyterlab. Currently, I find jupyterlab's auto complete feature to be very basic. It only provides suggestions if the case matches and the alphabets are consecutive.
If there is any extension that can be installed or a setting that needs to be tweaked, I will be very happy.
The closest question I found on Stack Overflow was Code autocompletion failed in Jupyterlab on Windows 10
However, It did not provide any useful info. I have included my jupyter details at the end.
For a clearer understanding of what I mean, please take a look at the below screenshots.
In VS Code, If I type 's', it suggests all variables beginning with the letter "S", irrespective of upper/lower case. However, in Jupyter Lab, it is case sensitive(It gets very irritating if it is case sensitive since I tend to use CamelCase quite often when naming variables).
Even Thonny, an awesome IDE created for teaching kids, has case-insensitive auto complete.
VS-Code goes one step further and matches variable names even if you skip a few characters in the variable's name. For example, in the attached image, you can see I just typed "spegg" and VS-Code understood I was aiming for "Spoilt_eggs"
In jupyterLab, If i type "S" and hit tab, it shows all variables whose names start with "S". If I type "s" and hit tab, It shows variables that start with "s". I would like it to suggest everything with "S/s" irrespective of case.
I had also installed some extensions or something to get jupyter to work in VS-Code. However, even in this mode(Jupyter inside VS-Code), the Visual Studio-Code Intellisense is not being used. It is reverting to the same autocomplete being used by JupyterLab in the browser(Case sensitive).
I am a self taught python programming amateur. Learnt in IDLE, then moved to VS-Code & Thonny, now JupyterLab(& thonny for debugging). I must say I am liking JupyterLab very much but am very unhappy with the Auto Complete.
If there is any extension that needs to be installed or a setting that needs to be tweaked, I will be very happy. My VS-Code extension says it uses something called Pylance. Is there any way to get Pylance onto JupyterLab?
My !jupyter --version output is :
jupyter core : 4.6.3
jupyter-notebook : 5.7.8
qtconsole : 4.7.3
ipython : 5.9.0
ipykernel : 4.10.1
jupyter client : 5.3.4
jupyter lab : 0.33.12
nbconvert : 5.6.1
ipywidgets : 7.6.5
nbformat : 4.4.0
traitlets : 4.3.3
I installed python from the pythonsetup.exe available in the python website. After that, I installed jupyterLab using pip.
I reproduced your question. I found that there is no problem. (If you install the python extension).
You can install the python extension according to the following picture:
Jupyter and pylance is included in "python" extension.
I recently did a full reinstall of Anaconda distribution because of some user-related problems I was having. I installed the latest 64-bit version for Windows 10, and my Jupyter Notebook stopped autocompleting just about everything (methods, library names, object attributes, etc.).
My current version is 7.19.0.
>>> conda list ipython
# packages in environment at D:\Users\my_user\Anaconda3:
#
# Name Version Build Channel
ipython 7.19.0 py38hd4e2768_0
ipython_genutils 0.2.0 pyhd3eb1b0_1
Prior to reinstalling, I was able to press the tab key when typing the first few characters of an object/library and the IDE would display a dropdown list of objects that started with the same string. I cannot get said list to display on the current version.
For some reason however, when I type a function's name, I can still press shift + tab to display the docstring and expected arguments. It's only the dropdown list that disappeared.
I have not been able to find a solution (despite other users are having this issue).
I was trying out VS Code with Jupyter but the variables never finish loading in the variable pane:
this is some info by my env:
Environment data
VS Code version: Version: 1.41.1
Extension version (available under the Extensions sidebar):2020.2.59126-dev
OS and version: macOS Catalina 10.15.2 (19C57)
Python version (& distribution if applicable, e.g. Anaconda): python 3.7.6 64-bit ('base':conda)
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
Relevant/affected Python packages and their versions: Jupyter
Did anyone else have this issue? Anyone know how to fix it? Is this really a bug or maybe just a problem with my set up?
Related sources:
gitissue: https://github.com/microsoft/vscode-python/issues/9773
reddit: https://www.reddit.com/r/vscode/comments/eub7n2/how_does_one_have_the_jupyter_variable_pane_in_vs/
quora: https://qr.ae/TDT92y
From the gitissue suggestion from the developers:
Can you try updating your build?
I couldn't find an easy way to do this except by right clicking on the gear icon for the python extension.
Then clicked install another version and clicked the most current one.
That made things work.
Enable Auto updating extensions:
With the command palette, one can also turn on automatic updates for extensions. Simply do:
Command + shift + p
then type:
updating extensions
and select
enable auto updating extensions
not sure if it will avoid this issue in the future but its worth a try.
I am importing plotly.offline in my basic.py file, but when i run this basic.py in the platform-ide-terminal, an error comes up and says, ImportError: No module named plotly.offline.
I am sure plotly is pip installed. When i checked it in the default Terminal in my Mac,
pip show plotly
it reads,
Name: plotly
Version: 4.3.0
Summary: An open-source, interactive graphing library for Python
Home-page: https://plot.ly/python/
Author: Chris P
Author-email: chris#plot.ly
License: MIT
Location: /Users/Lorentz/opt/anaconda3/lib/python3.7/site-packages
Requires: retrying, six
Required-by: dash, chart-studio
My default python in Terminal is 3.7.
So i am trying to set the default python of my Atom to 3.7. I googled and my answers are suggesting to set it through Atom→Preferences→Open Config Folder, and open.atom/packages/script/lib/grammars/python.coffee. This is from the official site https://atom.io/packages/script
But my problem is, under packages, i can't locate script.
i then tried to locate it from top menu, still no luck.
Would anyone please tell me where to locate the python.coffee file? or where actually is this "script"?
Go here and search for script. When it is found click install. Or go here and click install.
There is a file named init.coffee in the home/.atom directory. I don't know of a python.coffee file.