jupyter
jupyter copied to clipboard
Support for using python/jupyter within chroot-environment
I use a (i)python-executable (and conda-environment) from within a chroot environment.
Starting the chroot is wrapped in the conda-shell
-script, so setting the emacs-variable shell-explicit-file-name
is enough to go a shell with access to my desired python and conda when I run shell
.
However I have not yet found a way to configure which executable to use for emacs-jupyter.
It would be nice to be able to configure the python-binary that is used for launching kernels etc. That way, I could write/use a wrapper script that starts my chroot and uses the appropriate python from within that environment.
Are there any plans to make this possible?
#317 seems related.
Would #341 solve this problem? It would allow you to specify the Jupyter command to use. Also wouldn't kernelspecs be a solution? Define a kernelspec that uses a shell script which sets up the appropriate environment and then launches a python kernel, see for example https://www.rc.virginia.edu/userinfo/howtos/rivanna/custom-jupyter-kernels/.
See #387 for some related discussion
Would #341 solve this problem? It would allow you to specify the Jupyter command to use. Also wouldn't kernelspecs be a solution? Define a kernelspec that uses a shell script which sets up the appropriate environment and then launches a python kernel, see for example https://www.rc.virginia.edu/userinfo/howtos/rivanna/custom-jupyter-kernels/.
I don't know if it works with chroot-environment (never heard of it). But here is how I am using this fantastic package with the PR #341.
I am using the change given in #341 with jupyter in a virtual environnment. My setting in init.el is:
(setq jupyter-command-directory "~/.virtualenvs/jupyter/bin")
And in the org file I do have a setup section with a property line sth. like: `* Setup :noexport: Setup for using the right kernel etc.
#+property: header-args:jupyter-python :session /home/work/.local/share/jupyter/runtime/kernel-bezier.json
Start the kernel. We use a connection file and a specific /terminal/ so we can kill the kernel. Sadly to get the /org-notebook/ to work again you also have to kill the /jupyter-repl-.../ buffer.
#+begin_src sh workon jupyter jupyter kernelspec list jupyter kernel --kernel='poetry-learn-scientific' --KernelManager.connection_file='/home/work/.local/share/jupyter/runtime/kernel-bezier.json' #+end_src ` These commands, for the terminal, are meant to be an advice. Change them as you need!
I do hope this or a similar workflow also works in your case.