Using jupyter notebook in Luakit (web browser)? - python

Officially, jupyter notebook supports Chrome, Safari and Firefox (see paragraph 1.9 here). I'm trying to use it with the lightweight Luakit browser. My notebook opens correctly in Luakit, I can execute a cell by pressing the Run button in the task bar, but the keyboard isn't responsive from within the opened notebook window (the keyboard works elsewhere): I can't navigate, nor press shift + enter to execute a cell, nor even edit a cell.
Does any one know how to set up Luakit to be able to use it with jupyter notebook?

I have just found a simple solution to be able to use the keyboard from within a jupyter notebook cell: go into insert mode, by typing i (letter i). Unless someone can provide guidelines so that there's no need to first type i, I'll take this approach as an answer.

Related

Select code and run IDE/code editor for Python

Is there an IDE/code editor for Python that allows a user to highlight and run a portion of syntax on the window like how SAS allows it in its UI? I'm aware of code blocks in Jupyter Notebook but I would like to know if there's something that's more flexible/free-form exists?
there something like this in Spyder you can divide your code in executable cells like in Jupyter or other notebooks and you can execute with Ctrl + Enter.
This hotkeys and shortcuts have been discussed here if you need more informations.
Stack answer on hotkeys in Spyder

Python debugging and breakpoint

I usually use Matlab for processing results. However I'm required now to use Python. I want to set a breakpoint in a Python Jupyter notebook to go through functions. I was able to set up breakpoint but I can't actually go line by line debugging with this breakpoint. In Matlab I used to press F10 to do this.
In JupyterLab with the Xeus Python kernel (often tagged with 'XPython' when you are choosing the kernel) you can use the visual debugger. The run-next-line feature is the 'Next' button in the 'CALLSTACK' pane of the debugger panel. See the animation here for the 'Next' tooltip when hovering. And, although not featured in that animation, the tool tip actually shows 'Next (F10)' presently in my browser.
You can try it by clicking here. The session that spins up starts with a notebook open that has a nice introduction and guide to the features.
More can be found about the visual debugger here.
Current 'default' launches via MyBinder, have the Xeus Python kernel and the debugger available already. You can run the following code in a cell in any of those sessions to pull in the debugger demonstration notebook.
!curl -o debugger.ipynb https://raw.githubusercontent.com/jupyterlab/debugger/dfd6bf9d51a7a0cd78ca54f4173fcf527bd4d7fd/examples/index.ipynb
You'll find when you open it, that notebook also is set to trigger opening with the correct kernel necessary for debugging selected. Note that won't always be the first choice for when you start a new notebook.

Jupyter Dashboard - Displaying data in weird format

I have installed Jupyter dashboard, however, when I choose either Grid or Report layout, my data is displayed as below:
I have tried to uninstall and re-install but doesn't seem to work. I am running Jupyter notebook 6.1.6 and Python 3.
Any idea what might be causing this? It is the same on all my notebooks.
Many thanks in advance
That is definitely weird!! If the notebook or your code is acting weird sometimes it is best to press the “RESET BUTTON”. Reseting the kernel clears all in memory objects and restarts your code from the very top.
To reset the kernel press the reset button, which is the curved arrow button, located under the word 'Kernel'.

VSCode Jupyter: is there a way to make python interactive window work as default console?

I've recently switched to VSCode, and am wondering if there's a way to make the Python Interactive Window from the Jupyter support in VSCode work like the console in Spyder where I just have to select code and press ctrl+enter to send it, without having to create cells everytime.
For now I'm resigned to work with the Terminal until my code is clean and then create a cell when I have reusable code, and would like to just work directly with the PIW.
You can always change the default console setting by:
Opening the Command Palette (⇧⌘P)
Typing "Preferences:Open Settings (JSON)
Edit this line:
"python.dataScience.sendSelectionToInteractiveWindow": false
You should be able to do this with the latest python extension. The select the code you want to execute and press shift-enter. Is that not working?
For me (now) interactive mode runs after setting "jupyter.sendSelectionToInteractiveWindow": true
#FranciscoRZ. You should have seen a popup option for this, but if it didn't come up for you it can just be manually set in VSCode options. Just change this guy here:
Python->Data Science: Send Selection To Interactive Window
That should get you what you are looking for.
OP's Note: Accepting this answer because it will be the right anwser starting with the February release of VS Code Python
If you have the notebook saved as a python percentage script (which is more git friendly)
each "cell" will be delimited by # %% and the default run command is "Shift+Ctrl".
Later once you are working in the interactive window, If you want a particular cell you wrote on the fly to be in you script, there is one button which says "Paste code into file" right next to the recently executed cell in the interactive window.
And in case you are using the notebook for the sake of being able to later export it to html or pdf, once executed in the interactive window, there is an export button as well.

Is it possible to copy a cell from one jupyter notebook to another?

I am trying to copy cells from one jupyter notebook to another. How this is possible?
This feature has been introduced in Jupyter Notebook 5.0.
Use pip install notebook --upgrade to upgrade to the latest release.
The old shortcuts C, V and X work only for copying and pasting inside one notebook. In order to do it across tabs, you should use Ctrl-C and Ctrl-V (Cmd-C and Cmd-V on Mac).
Note on multiple cells: currently (jupyter 6.0.0) on Mac+chrome using shift-click to select the cells then cmd-C does NOT work, while using the keyboard with shift-down-arrow does! (thanks drevicko for pointing this out)
With jupyter 5.0.0, copy paste of one or many cells from one notebook to another works with Cmd C Cmd V (Mac).
For copying many cells together, select the first one then the last one with shift arrow (up or down).
The tool bar does not work for this purpose.
See also
https://github.com/jupyter/notebook/issues/2336
I have not done it myself though, but general practice is to avoid doing it as it can disturb the Cell JSON. It was not even possible until a few versions before. Recent Github posts has made it possible to do so though. Copy paste the cell in question to a code editor such as Atom or Sublime Text, make the changes you want to do and then paste it into the new Jupyter notebook. It should work.
For windows-
Use Ctrl + Shift + C to copy cells after selecting them using shift + arrow keys.
Then, switch to the notebook to which you want to copy the selected cells and go to command mode in it by pressing Esc key.
Then, use Ctrl + Shift + V to paste the cells in that notebook.
Note- I have not tested this on Linux but should work just as the procedure above.
VSCode can open and execute jupyter notebooks.
In the same software it is also possible to cut/copy and paste from one notebook to another (something that I didn't manage to do with jupyter notebook or lab).
It saved me a lot of time.
In JupyterLab, you can view two notebooks arranged as panes side-by-side. (Or even two views of the same notebook.)
Then you can select a cell or continuous range of them. When they are highlighted go to the top cell and click and drag over to the other notebook to copy them.
You can download the cell content as .py file from jupier and then you can copy and paste wherever you want

Categories

Resources