jupyter icon indicating copy to clipboard operation
jupyter copied to clipboard

Support for using python/jupyter within chroot-environment

Open moritzschaefer opened this issue 3 years ago • 4 comments

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?

moritzschaefer avatar Mar 23 '21 15:03 moritzschaefer

#317 seems related.

fleimgruber avatar Mar 24 '21 10:03 fleimgruber

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/.

nnicandro avatar Nov 18 '21 20:11 nnicandro

See #387 for some related discussion

indigoviolet avatar Feb 25 '22 04:02 indigoviolet

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.

Uriziel47 avatar Apr 18 '22 19:04 Uriziel47