Skip to content

Commit 5c2eaab

Browse files
authored
Add pipx instructions to README
1 parent 4ec510a commit 5c2eaab

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.rst

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,35 @@ To use it, run one of:
2323
jupyter qtconsole --kernel bash
2424
jupyter console --kernel bash
2525
26+
27+
`pipx` and "externally managed" environments
28+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29+
30+
A recent-ish `PEP 668 <https://peps.python.org/pep-0668/#guide-users-towards-virtual-environments>`_ recommends that users install Python applications with `pipx` rather than global installs with `pip`. This is strongly suggested/enforced in current Linux distros. Because `bash_kernel` needs an extra step to actually work after installing with `pip` or `pipx`, this causes some inconvenience.
31+
32+
First, one must install the Jupyter ecosystem with pipx, and then inject bash_kernel (and any other bits of the jupyter ecosystem you use, like papermill) into the same pipx venv.
33+
34+
.. code:: shell
35+
36+
pipx install --include-deps jupyter
37+
pipx inject --include-apps --include-deps jupyter bash_kernel
38+
39+
One then must manually find the corresponding venv, activate it, and run `python -m bash_kernel.install` *within* that virtual env. If done outside it, this won't work as bash_kernel is not installed in the global environment.
40+
41+
.. code:: shell
42+
43+
cd ~/.local/pipx/venvs/jupyter/
44+
source bin/activate
45+
python -m bash_kernel.install
46+
deactivate
47+
48+
Of course, one can also install bash_kernel to the global environement thusly:
49+
50+
.. code:: shell
51+
52+
pip install --break-system-packages juptyer bash_kernel
53+
python -m bash_kernel.install
54+
2655
Displaying Rich Content
2756
-----------------------
2857

@@ -64,7 +93,7 @@ Programmatically Generating Rich Content
6493
----------------------------------------
6594

6695
Alternatively one can simply generate the rich content to a file in /tmp (or $TMPDIR)
67-
and then output the corresponding (to the mimetype) context prefix "_TEXT_SAVED_*"
96+
and then output the corresponding (to the mimetype) context prefix ``"_TEXT_SAVED_*"``
6897
constant. So one can write programs (C++, Go, Rust, etc.) that generates rich content
6998
appropriately, when within a notebook.
7099

0 commit comments

Comments
 (0)