Using R in a jupyter notebook in VSC without Python - r

I know it looks somewhat weird, but I'm trying to use R in a .ipynb file in VSCODE. I know it's possible(I'm doing it on my own computer), but due to limitations on my company, I cannot install python to my work-computer. Hence jupyter notebook always ask for a kernel to start, but since I don't have python, I cannot initialize it. Anyone know how to handle kernel issue?
I literally tried every source, but this is a problem 99.9% of people won't face.

Related

code_prettify not working for Julia in Jupyter Notebook

I am using Julia 1.8.4 in Jupyter, however, I get the following error message when I start it up.
[code_prettify] Sorry, can't use kernel language julia.
Configurations are currently only defined for the following languages: python, r, javascript
See readme for more details.
If I click "Ok", I am able to run the code in the cells but Jupyter does not highlight Julia code. It continues highlighting Python code and syntax. Is there a way I can fix this?
Or could someone refer me to the documentation?
Like the error message indicates, code_prettify only has configurations inbuilt for Python, Javascript, and R. From the docs:
Example implementations are provided for prettifiers for ipython, ir and ijavascript kernels which should work out of the box ...
Other languages may be added as defaults in the future
Support for Julia is yet to be added, hence the error message.
That said, code_prettify is only needed if you want to reformat your code (semi-)automatically. Syntax highlighting should work regardless, without any extension, and based on my testing, it does. Loading a notebook with a Julia kernel, the error message appears in the console, but the code is syntax-highlighted as usual.
So, if the syntax highlighting problem persists across notebook restarts, the issue must be with some other part of your notebook setup.

VScode showing raw source code instead of the remote jupyer notebook

I'm a bit puzzled of what goes wrong, and maybe someone here knows, or has had it before.
First, i got Docker on windows 11.
It runs a ubuntu python container, for all kind of AI stuff.
My local windows PC, has Vscode, i've made a connection to the local container (ssh).
When i open a .ipynb I see the raw file a Json like structure.
That is a bit strange because if i create a new ipynb on windows 11
Its is showing code/markdown cells normally like how vscode shows it normally.
VScode should know what Jupiter notebooks are
So Vscode knows python, everything seems installed in relation to jupyter and remote (localhost) connections.
Does anyone know perhaps what is going wrong here?.
Maybe its something i overlooked, missed.
Or some extra step that needs to be done at VScode, or i open it wrongly ?.
I open the file through the left pane open.. as shown:
I believe all related jupyter notebook stuff is installed in VScode
PS C:\python projects\test> code --list-extensions --show-versions
btwiuse.vscode-remote-server#0.0.5
colinfang.my-nbpreviewer#1.2.2
GitHub.copilot#1.56.7152
jithurjacob.nbpreviewer#1.2.2
ms-azuretools.vscode-docker#1.22.2
ms-dotnettools.csharp#1.25.0
ms-python.python#2022.16.1
ms-python.vscode-pylance#2022.10.40
ms-toolsai.jupyter#2022.9.1202862440
ms-toolsai.jupyter-keymap#1.0.0
ms-toolsai.jupyter-renderers#1.0.10
ms-toolsai.vscode-jupyter-cell-tags#0.1.6
ms-toolsai.vscode-jupyter-powertoys#0.0.6
ms-toolsai.vscode-jupyter-slideshow#0.1.5
ms-vscode-remote.remote-containers#0.255.4
ms-vscode-remote.remote-ssh#0.90.1
ms-vscode-remote.remote-ssh-edit#0.84.0
samghelms.jupyter-notebook-vscode#0.0.2

How to make sure my jupyter notebook is runnable on any other computer or on any jupyter Lab?

An analytic task has been given to me to solve it by python and return back the result to the technical staff. I was asked to prepare the result in a jupyter notebook and such that the resulting code would be fully runnable and documented.
Honestly, I just started using jupyter notebook and generally found it pretty useful and convenient in generating reports integrated with codes and figures. But I had to go into some level of difficulty when I wanted to use specific packages like graphviz and dtreeviz, which was beyond doing a simple pip install xxx.
So, how should I make sure that my code is runnable when I do not know what packages are available at the destination Jupyter notebook of the next guy who wants to run it or when they want to run it using a Jupiter Lab? especially regarding these particular packages!
One solution for you problem would be to use docker to develop and deploy your project.
You can define all your dependencies, create your project and build a docker image with them. With this image, you can be sure that anyone who is using it, will have the same infrastructure like yours.
It shouldn't take you a lot of time to learn docker and it will help you in the future.

Jupyter notebook is eating all my memory and then crashes

I have been getting involved with the Python language, and especially through Jupyter notebook. I think Jupyter is great for prototyping code in a very convenient way. I've been working on code according to this tutorial over the past 2 days:
https://medium.com/#omar.ps16/stereo-3d-reconstruction-with-opencv-using-an-iphone-camera-part-iii-95460d3eddf0, and it's been working fine.
However, when I woke up this morning, it seems that a memory issue is causing Jupyter to crash. When I start Jupyter, there is no such memory issue, it is only when I click on my particular notebook file. Then the memory gradually increases (as seen on the task manager). Also, the screen is non-reactive, so I cannot reach the restart kernel or any of these options in the kernel. After about 30 seconds, the entire Jupyter system crashes due to a memory overflow.
I would greatly appreciate any help with this problem.
Okay I figured out that I was printing a huge matrix out, which blocked up the system. I had to open the notebook with notepad++, and get rid of the data that way, and everything is running fine. Stupid mistake.

ipython notebook hang when open a large notebook

I am using the LATEST (2.2.0) ipython notebook, when I create a notebook with a loop to write many lines (about 20000 lines), then it run forever I guess since I always see the running icon at the top right. Even if I restart the computer and reopen the notebook again, it will into a running mode automatically, then I almost unable to do anything in this page. I have to copy the code and new another page to fix it.
How can I fix such hang issue during open a too large notebook? I have tried the kernel "interrupt" and "restart" menu and it seems no any effect at all.
IPython notebook is not intended to do such tasks with too much calculation or too many output data because actually such things is for standalone program rather than a notebook.
To fix such issues, you need to create a standalone application (script) to do it from console, then paste the meaningful result into IPython notebook.

Resources