If I installed Python/Pip stuff inside my Toolbox, can I safely do `dnf remove '*'` in the container to remove all the stuff Python/Pip installed?

title basically. I installed Plotly & Jupyter Notebook inside a toolbox container but then I noticed I can access jupyter from my host (though it returns this)

reihan at aurora in ~ via  v3.13.3 
✦ ✗  jupyter -v
Traceback (most recent call last):
  File "/home/reihan/.local/bin/jupyter", line 5, in <module>
    from jupyter_core.command import main
ModuleNotFoundError: No module named 'jupyter_core'

Which is still concerning for me.

1 Like

What is ~/.local/bin/jupyter ? Is it a regular python script? Or a distrobox proxy command put in place with export_bins ?

Think through what the differences are with me for a minute.

Python script installed in distrobox

If jupyter is a regular prython script that was installed in a distrobox, then even though you managed to get the entrypoint script in place, all the stuff on which it relies - just one thing is the jupyter_core module - is not accessible on the host. This is because of PYTHONPATH, etc.

You need to arrange for it to execute IN the distrobox where it was installed. That is the purpose of the distrbox.ini export_bins property.

exported via export_bins

When export_bins / export_bins_path pair are used to define what should happen when a distrobox assemble operation is performed it installs a proxy script for the command in question.

In the sample below for the gitk app (python GUI app), if the CONTAINER_ID env var is set, it calls the following which arranges for /usr/bin/gitk to be executed in the fedora41-python-dx distrobox container.

exec "/usr/bin/distrobox-enter"  -n fedora41-python-dx  --  '/usr/bin/gitk'  "$@"

proxy command script for gitk

#!/bin/sh
# distrobox_binary
# name: fedora41-python-dx
if [ -z "${CONTAINER_ID}" ]; then
        exec "/usr/bin/distrobox-enter"  -n fedora41-python-dx  --  '/usr/bin/gitk'  "$@"
elif [ -n "${CONTAINER_ID}" ] && [ "${CONTAINER_ID}" != "fedora41-python-dx" ]; then
        exec distrobox-host-exec '/var/home/klmcw/.local/bin/gitk' "$@"
else
        exec '/usr/bin/gitk' "$@"

I have published an article in the bluefin forum here and the code in a oci-shared-images repo if you are interested.

The lines that produce the proxy command script above are here.

I hope that helps.

As to your last question - in general, yes. A toolbox / distrobox is just a running container. It can be removed anytime. Anything you have done manually in your host $HOME dir will also need to be cleaned up manually.

Otherwise, the distrobox should be thought of like a VM - meaning whatever you install you can also remove. For example, you may want to install python3.14-freethreading like I did to do some testing. Later on you may want to remove it via sudo dnf remove python3.14-freethreading.

Just be aware that the script left in ~/.local/bin (in the case of my example) will no longer be valid and will need to be removed manually.

I hope that makes sense.