VS code in a jupyter notebook? - visual-studio-code

I am looking to see if it's possible to run vs code from a jupyter notebook, as in have it as a kernel that I can use to run vs code in the web browser.
https://docs.anaconda.com/anaconda/user-guide/tasks/integration/vscode/
Is this even possible?
So have what appears in anaconda navigator below, appear in the jupyter lab ui below.

I found this.
https://github.com/jupyterlab/jupyterlab-monaco
Although it's "merely a 'proof-of-concept' implementation and nowhere near production status" so not ready for my use case yet. Still it's there for those interested.

Related

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.

Run Julia from remote using Jupyter locally

I apologize if it is a trivial question, but I searched and I could not find the answer. My situation is the following:
I have access to a server through ssh tunnelling. The server has Julia installed but not jupyter.
My machine has both, and my code is mostly in jupyter notebooks and I wish to keep it that way.
I wish to be able to run my code on a julia kernel on the server, but editing from a Jupyter interface/ IJulia locally.
I have found several guides on how to launch jupyter from remote, but they do not apply since the server does not have jupyter installed. Similarly, I am aware I could convert my code in a julia script and run it, but I would rather keep the convenience of a notebook for editing.
Is this even possible to do?
Any help is very appreciated!

Issue with Pylance and matplotlib

I have looked at these problems online but I don't seem to be able to find a good answer.
System details:
Mac OS BigSur 11.6 on a M1 MacBook Pro
Installed miniforge as discussed here
Installed VSCode for Mac
I have these two following (unrelated?) problems when using jupyter notebook:
PyLance does not resolve imports like numpy etc. I see that os or sys are recognized and resolved but pretty much nothing else is. The kernel used by the jupyter notebook is the correct one. Indeed I am able to run the code with no issues but I get all these unrecognized imports.
I am not able to run the jupyter notebook with %matplotlib notebook. I can run with %matplotlib inline, but then I am not able to see the widgets to zoom in etc. To be more precise, if I try to plot in a cell then after it I see the following:
either nothing or
the following <IPython.core.display.HTML object>
This is achieved by clicking on the symbol </> and changing the rendered from html to text.
I am wondering if there is some issue with my installation of python and jupyter on the M1 or it is a VSCode issue. Any suggestion on where to look into the problem(s)?

VS Code - Why is my Jupyter Notebook UI a bit different from official docs?

I'm using the latest VS Code version 1.56 (April 2021) and I installed the official Jupyter extension of version v2021.6.811652604, which is also the latest version.
In the version 1.56 update notes, there's a screenshot showing the UI of a Jupyter Notebook:
As you can see, the cell input UI contains a toolbar at the top right corner and there's also two buttons ("+ Code" and "+ Markdown") at the cell's bottom.
However, it seems like my VS Code Jupyter extension is still using the old UI. When I create a new notebook by running the Command Palette command Jupyter: Create New Blank Notebook, here's what the UI looks like in my VS Code:
Even when I'm hovering over the cell, I cannot see the toolbar at the top right corner similar to that in the update notes. Also, I see no "+ Code" and "+ Markdown" buttons.
Can anyone explain why this is the case? Do I need to use VS Code Insiders in order to get the UI in the first screenshot? Thanks a lot!
Update 1
I have updated my Jupyter Notebook using pip install notebook --upgrade and still VS Code is having the old UI as shown in the second screenshot
Thanks to Alex's comment, the reason is that the first screenshot is taken under VS Code Insiders Edition, in which it is using the Notebook API to add more UI components and functionalities to the Jupyter Notebook.
According to the Notebook API documentation:
Note: The Notebook API is still proposed and under development, which
means it is only available on VS Code Insiders and requires adding
vscode.proposed.d.ts to your extension project.
Since I'm using the stable release of VS Code, Notebook API is not available yet and hence it's still using the old UI.

Regarding "torch" package - with anaconda environment using vscode as editor

I am currently working on project,where I use pytorch as deep learning environment. I have serious problem, that .... "When I use anaconda jupyter notebook terminal to run my *.py files. Then, it run properly. But, when I use the same environment within vs-code via python_interpretor, I can not get result and give me error "torch module can not found".
Can anyone have solution?. Actually, I see the packages using "conda list" and it includes torchvision inside environment. I also tried to install torch in base environment But, it does not work.
Please give me some solution. Thank you for your consideration.