Yes, those examples are all being served via Mybinder.org.
Did you just try running
%pip install lxml in your notebook? You sure that doesn’t get you want you need? (I’ll continue on with other options, assuming
pip alone doesn’t cover your needs here. However, if it did, you could just use a simple
requirements.txt configuration file to specify that for future launches of the environment you need, see here, with an example here. This tends to be the simplest way to specify an environment in conjuction with MyBinder launches.)
See below if you aren’t sure that apt-get is the only route to install what is needed. Often conda (actually mamba in mybinder building images for the containers) is faster and easier. See here and here. Plus using
%conda install you can often do from within a session that is already running, see the section below for more as the rest of this section, I’ll answer your question about how to use
apt-get in conjunction with MyBinder.
You cannot do what you are trying to do from within a launched session. However, you can configure an environment to launch as you specify. MyBinder works with many things besides Github and so you aren’t restricted to that even. You can go to the link above and click on the drop-down on the left below ‘GitHub repository name or URL’ to see the possibilities.
In your repository you’ll make a text file names
apt.txt and put ‘python3-lxml’ on a line as the content there. This configuration file will direct the MyBinder service to build the image that will launch the served environment using apt-get to install that dependency as described here.
Resources about this:
That is if you are sure that using
apt-get is the only way to install it. Use of
%conda install lxml, based on here and here in a running session isn’t working?
In discussing conda/mamba above, I quickly pointed out above why if that installs what you want, that use of
environment.yml to configure the environment may be better for your.
environment.yml is another type of configuration file that you can use to direct MyBinder to build the appropriate environment for launches, see here.