How can i disable Jupyter as VS Code's default Python executor? - visual-studio-code

Jupyter kernel is slow to load and I don't need code cells in VS Code (they're poorly formatted anyways, and just awkward). Is there any way to disable Jupyter kernel as the executor and just go back to using ipython in the attached VS Code terminal?

This is what you need:
"python.dataScience.sendSelectionToInteractiveWindow": false
You can make it directly on settings.json file or through settings tab: Python > Data Science: Send Selection To Interactive Window.
You can make it at user or at workspace level.

Related

Stop automatic `conda activate` when opening a terminal in VS Code

VS Code has started running conda activate every time I open a terminal in VSCode, be it PowerShell, WSL, or CMD.
I never set this up intentionally so have no idea why it does this or how to disable it. I've looked at all my settings in VS Code and cannot find anything.
How do I stop VS Code from running conda activate when a new terminal is opened?
Try putting the following in your settings.json file:
"python.terminal.activateEnvironment": false
You're getting this behaviour because the default value of that setting is true if not specified.
For more info, see VS Code's docs on Using Python environments in VS Code- in particular, the Working with Python interpreters
section, and the Environments and Terminal windows
section.
Quoting from that page:
Tip: To prevent automatic activation of a selected environment, add "python.terminal.activateEnvironment": false to your settings.json file (it can be placed anywhere as a sibling to the existing settings).
Reading the changelog, this setting was added in version 2018.9.0 of the Python extension for VS Code. The PR that added it was #1387.

Why do my internal hyperlinks not work in my notebook when creating them remotely?

I have quite a large jupyter notebook I'm working on in VScode, while using the high performance computing facility (connected through SSH).
I am trying to create some internal hyperlinks so I can jump from my table of contents to a specific section in the notebook. However, this does not work.
Code I'm using to create the link:
[Summary](#Summary)
some other cells
## Summary
It does create a link, but clicking on it does not work in VScode. This one keeps me right at the top of the notebook, other links to sections further down bring me to seemingly random cells down my file. Also, when opening the notebook in Github, clicking the link brings me back to the folder where my notebook is located.
The same construction does work both in a local jupyter instance, and in vscode, when not connected to the HPC.
One difference I can think of is that I use miniconda on the HPC, and the full anaconda installation locally.
Are the links not supported in miniconda? Or is it something else?

How can I programmatically check that I am running code in a notebook in julia?

I would need to programmatically check that I am running code in a jupyter notebook from Julia. One way would be using
isdefined(Main, :IJulia)
However this does not work for notebooks within vscode since they are run from outside IJulia is there a check that would work in this case as well?
What about #__FILE__ this yields REPL[_] in Julia REPL, In[_] in Jupyter and "/path/to/file.jl#==#hashocde" in Pluto so the test could be:
match(r"^In\[[0-9]*\]$", #__FILE__) != nothing
and in VSCode:
so you can check if the file ends with ".ipynb" if you want to find VSCode. Moreover: isdefined(Main, :VSCodeServer) yields true if you run from VSCode.

Does VS code have variable explorer object like we have it in spyder?

I will post the picture of what exactly I am asking variable explorer in spyder
So do we have this feature in VS code?
I tried a lot to find it on google but was unhappy to not find it.
Open your .py script in vscode
Right click anywhere on the script > Run current File in interactive Window
In the toolbar of the interactive window click on the variable icon
You can now consult the values of variables created by your script
spyder is probably running a REPL (Jupyter is doing that also). From that python process they show the local and global variables, just like a debugger would do on a breakpoint.
If you use Python Interactive you have similar functionality with the Variables Explorer and Data Viewer or use Jupyter notebooks
You can now find all variables in a Jupyter Notebook in VS Code in the Output panel under Jupyter: Variables

how to disable jupyter editor in vscode

like the title mentioned, how to disable jupyter editor in vscode?
every time,I want to new a file just for text or markdown,I do not like to appear a choice between two, but just default for the inner editor applied by vscode. and how can I configure this.
for right now,I never need to use jupyter notebook.
It seems to be appeared unexpected after vscode update or installed some python package.
This can be disabled by python.dataScience.useNotebookEditor if you are using the Python extension.
Source: https://github.com/microsoft/vscode/issues/103526
Update:
You also need the Jupyter extension along with Python extension for VS Code. The setting key has been renamed from python.dataScience.useNotebookEditor to jupyter.useNotebookEditor^update
With the July/August 2021 introduction of the new Native Notebook Support in VS Code, the answers involving your settings.json are now obsolete. Now the Notebook editor will be used to open .*ipynb files even if you've never installed the Python or Jupyter extensions.
However, you can open a *.ipynb file in the regular text editor by right-clicking on the file in the VS Code File Explorer, doing "Open With", and then selecting the "Text Editor".