Home

Awesome

Code style: black

--==================================================--

 _______ ___. ___________                  .__
 \      \\_ |_\__    ___/__________  _____ |__|__  ___
 /   |   \| __ \|    |_/ __ \_  __ \/     \|  \  \/  /
/    |    \ \_\ \    |\  ___/|  | \/  Y Y  \  |>    <
\____|__  /___  /____| \___  >__|  |__|_|  /__/__/\_ \
        \/    \/           \/            \/         \/

      -| Jupyter Kernels in Your Terminal |-

--==================================================--

NBTERMIX SCREEN

Lets you view, edit and execute Jupyter Notebooks in Your terminal.

Install

Using pip:

pip3 install jupyter_client ipykernel nbtermix

Usage

Open an interactive notebook:

$ nbtermix foo.ipynb

Run a notebook in batch mode:

$ nbtermix --run foo.ipynb

Quickstart

1] execute: nbtermix foo.ipynb

2] There should be Notebook ready for You to use

3] ctrl+o to open current cell in external editor

4] type Your python expression, function etc. (like 1+1)

5] press enter to execute current cell

6] type key b to insert cell below

7] repeat from step 3 to continue

For more information type ctrl+h

If the cell execution fails then see Troubleshooting section.

Hints:

Docker

For docker environment build use:

./docker.sh

To build the docker machine and then:

docker run -it nbtermix:docker

To run the docker with nbtermix.

Key bindings

There are two modes: edit mode, and command mode.

In edit mode:

In command mode:

Kernels

For more kernels visit:

Jupyter kernels . jupyter/jupyter Wiki

This nbtermix is tested on (install only if You know what You're doing):

c kernel

pip install jupyter-c-kernel
install_c_kernel

java kernel

wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
unzip ijava-1.3.0.zip -d ijava
cd ijava
python install.py
apt-get isntall default-jdk

javascript kernel

apt-get install nodejs npm libczmq-dev
npm install -g --unsafe-perm npm
npm install -g --unsafe-perm ijavascript
ijsinstall --install=global

php kernel

apt-get install php composer php-zmq
wget https://litipk.github.io/Jupyter-PHP-Installer/dist/jupyter-php-installer.phar
chmod u+x jupyter-php-installer.phar
./jupyter-php-installer.phar install

sqlite kernel from sqlok

pip3 install sqli-kernel
sqlik_install

python3 kernel

out of the box

Testing environment

on Debian X using Python 3.7 (with kernel.json patch see Troubleshooting)

$ jupyter --version:

IPython          : 7.31.0
ipykernel        : 6.6.1
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
traitlets        : 5.1.1

Runtime Environment recommendations

Keep separated environment for the nbtermix

|= mkdir -p ~/pyenv
cd ~/pyenv
|= virtualenv -p /usr/bin/python3.9 nbtermix
|= source ~/pyenv/nbtermix/bin/activate

CHANGELOG

minor changes in v.0.1.4 by mtatton
* added ! keyboard shortcut to go to
  external editor from command mode
* when there was a cell edit in
  external editor the cell didn't
  refresh
minor changes to v.0.1.3  by mtatton
+ fixed search function (keys /,n,N)
minor changes to v.0.1.2  by mtatton
+ changed visible cells display a bit
+ added ctrl + f for current cell focus
+ added raw text/plain display 
+ added raw text/html display 
minor changes to v.0.0.18 by mtatton
+ scrollable output using left and right
minor changes to v.0.0.17 by mtatton
minor changes to v.0.0.16 by mtatton
minor changes to v.0.0.15 by mtatton
+ added folding for terminal space saving
+ renamed to nbtermix
minor changes to v.0.0.14 by mtatton
minor changes to v.0.0.13 by mtatton
minor changes to v.0.0.12 by mtatton

TROUBLESHOOTING

Problem: Python (busy) and nothing happens

Solution: Verify if python3 kernel is called

list python3 kernel location

$ jupyter kernelspec list

Find kernel.json in the destination (e.g.):

python3|/usr/local/share/jupyter/kernels/python3

In case Your system has both Python 2.7 and 3.x the nbtermix tries to run Python 2.7. And that's something that doesn't work.

Ensure in Your kernel.json for python3 the argv is python3:

cat /usr/local/share/jupyter/kernels/python3/kernel.json
{
"argv": [
*"python3"*,
"-m",
"ipykernel_launcher",
... etc.

Problem: On Debian 11 there is no /usr/bin/python binary

In case You are sure there is no Python 2.x installed on Your machine. You can prepare the binary by updating the default /usr/bin/python alternative. You can do this as follows:

update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2