Closed benz0li closed 5 months ago
@jyio You may test yourself with b-data's/my demo deployment at https://demo.jupyter.b-data.ch.
ℹ️ Login with your GitHub account.
Hey, thank you for trying this out.
It looks like it has trouble finding marimo
, which gets installed into ~/.local/bin/
. The tricky bit is the $PATH
that JupyterHub sees might be different from the $PATH
that the shell sees. Both .zshrc
and .bashrc
prepend ~/.local/bin/
to $PATH
, but I suspect JupyterHub doesn't.
For example, I have this line in my user containers' Dockerfile to allow the single-user JupyterHub to see what the users install:
ENV PATH=~/.local/bin:$PATH
Later, I could try making a variant that checks ~/.local/bin/
first.
After setting
PATH=/home/benz0li/.local/bin:/opt/TinyTeX/bin/linux:/opt/quarto/bin:/opt/code-server/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
and
pip install click
and clicking on Marimo
, a new page opens showing
{"detail":"Not Found"}
but nothing more in the [container] logs.
I think this needs more work.
With my JupyterLab Julia docker stack, one can simply execute
julia -e 'Pkg.add("Pluto")'
pip install jupyter-pluto-proxy
restart the server (container) and click on Pluto Notebook
.
Everything works out of box – thanks to @yuvipanda.
Addendum:
The following startup files are in place for Julia: https://github.com/b-data/jupyterlab-julia-docker-stack/tree/97fa5731a5272d13261e7f1ece7ee737dd293a31/base/conf/julia/etc/skel/.julia/config
ℹ️ For more information, see https://github.com/b-data/jupyterlab-julia-docker-stack/blob/97fa5731a5272d13261e7f1ece7ee737dd293a31/NOTES.md#julia-startup-scripts
As suspected, PATH=/opt/TinyTeX/bin/linux:/opt/quarto/bin:/opt/code-server/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Here's a hack that finds Marimo in the search path prepended with ~/.local/bin/
.
Try this:
$ pip install marimo click
$ pip install git+https://github.com/jyio/jupyter-marimo-proxy@user-local-bin
After restarting the container and clicking on Marimo
, it works for me... but does it work for you? 🤔
After restarting the container and clicking on
Marimo
, it works for me... but does it work for you? 🤔
No. Clicking on Marimo
, a new page opens showing
{"detail":"Not Found"}
but nothing more in the [container] logs.
IMHO PATH
needs to be updated properly – and not just to find the exe
for the command
.
Like it is done in /usr/local/etc/ipython/ipython_config.py
for my JupyterLab docker stacks: https://github.com/b-data/jupyterlab-python-docker-stack/blob/31e08865205b001330207cd1a17e5277c48e6a2c/base/conf/ipython/usr/local/etc/ipython/ipython_config.py#L3-L24
ℹ️ This ensures ~/.local/bin
and ~/bin
are not only taken into account by JupyterLab Terminals but also JupyterLab Notebooks and Consoles.
But even when providing a properly updated PATH
, the page shows
{"detail":"Not Found"}
P.S.: It does not work with a non-localhost
deployment of code-server using the marimo extension, either:
But even when providing a properly updated
PATH
, the page shows{"detail":"Not Found"}
Interesting. Your first post mentions /user/benz0li/marimo/marimo/
and /user/benz0li/marimo/lab
in your production setup. So it seems my assumption that --base-url
should be '/user/' + os.environ['JUPYTERHUB_USER'] + '/marimo'
is incorrect. It would probably be better to make it os.environ['JUPYTERHUB_SERVICE_PREFIX'] + 'marimo'
instead, like so.
Would you please try git+https://github.com/jyio/jupyter-marimo-proxy@service-prefix
?
Edit: And, I agree that the $PATH
issue is out of scope. This project should not make any assumptions about the user's (or admin's) search path priorities. But I'd probably leave that branch there for convenience's sake.
Your first post mentions
/user/benz0li/marimo/marimo/
and/user/benz0li/marimo/lab
in your production setup.
/user/benz0li/marimo/
because I called my JuypterHub Named Server marimo
.
/user/benz0li/marimo/marimo/
= The resulting URL when clicking on Marimo
.
/user/benz0li/marimo/lab
= The default URL of my setup, i.e. JupyterLab.
No time for further testing. You can use https://demo.jupyter.b-data.ch as test environment.
Alright, so I set up a minimal JupyterHub with named servers, and JUPYTERHUB_SERVICE_PREFIX
appears to work. Just let me know later if it works for you also 😉
I did
$ pip install marimo click
$ pip install git+https://github.com/jyio/jupyter-marimo-proxy@user-local-bin
in a terminal at https://demo.jupyter.b-data.ch/ with Python (jupyterlab/python/scipy:latest) image
File / Hub Control Panel > Stop My Server then Start My Server (still with jupyterlab/python/scipy:latest) image)
I can see now Marimo icon
and run a simple sample Marimo notebook here also
Thank you @scls19fr for trying the search path hack.
https://github.com/jyio/jupyter-marimo-proxy/issues/1#issuecomment-2183815516
IMHO
PATH
needs to be updated properly – and not just to find theexe
for thecommand
.Like it is done in
/usr/local/etc/ipython/ipython_config.py
for my JupyterLab docker stacks: https://github.com/b-data/jupyterlab-python-docker-stack/blob/31e08865205b001330207cd1a17e5277c48e6a2c/base/conf/ipython/usr/local/etc/ipython/ipython_config.py#L3-L24 ℹ️ This ensures~/.local/bin
and~/bin
are not only taken into account by JupyterLab Terminals but also JupyterLab Notebooks and Consoles.
Here's how one might patch PATH
directly, and it should be transmitted to children this way:
https://github.com/jyio/jupyter-marimo-proxy/blob/bc51eaa5a22ae403a25e59993819d8a07187808a/jupyter_marimo_proxy/__init__.py#L8
But, if you ask me about properly updating PATH
, I'd have to say the right way is to do it as early in the chain of events as possible. Do it once in your Dockerfile, and everything inherits your intended PATH
(with some exceptions). No need to futz around with PATH
in .bashrc, .zshrc, your Julia config, your IPython config, your Marimo config, etc...
But, if you ask me about properly updating
PATH
, I'd have to say the right way is to do it as early in the chain of events as possible. Do it once in your Dockerfile, and everything inherits your intendedPATH
(with some exceptions). No need to futz around withPATH
in .bashrc, .zshrc, your Julia config, your IPython config, your Marimo config, etc...
Every path outside a user’s home directory: Yes.
Every path within a user’s home directory: No.
For example, I have this line in my user containers' Dockerfile to allow the single-user JupyterHub to see what the users install:
ENV PATH=~/.local/bin:$PATH
Prepending ~/.local/bin
to PATH
in the Dockerfile (i.e. hard-coding) is bad practice.
ℹ️ https://jupyterhub.readthedocs.io/en/stable/explanation/websecurity.html
PATH
is not static. Conda would not work w/o manipulating PATH
.
But even then, it’s complicated:
Really complicated:
For sure, it's complicated. There are lots of smart folks with strong opinions about what the search path should be, and I'm not one of them 😅
So let's just sort out the issue with the named servers because there's a straightforward solution (let me know if it works for you so we could lay this to rest).
And we could keep the special case with the ~/.local/bin
search path prefix in its own branch, though I don't think it'd be a general solution for everyone (smart people, strong opinions, etc).
With b-data's/my JupyterLab docker stacks (or the demo deployment at https://demo.jupyter.b-data.ch), I recommend
pip install marimo click
pip install git+https://github.com/b-data/jupyter-marimo-proxy.git@jupyterlab-docker-stack
for now. Then restart the server (container) and click on Marimo
.
I tried with b-data's/my reference deployment at https://jupyter.b-data.ch, i.e.
After restarting the server (container) and clicking on
Marimo
, I see the following in the logs:Cross reference:
Ping @jyio