SVG not rendering correctly in a container

I created a docker image at

Examples showing the problem described below are in the notebook

The notebooks exercise code that returns IPython.display.SVG objects.
These render correctly when I run jupyter directly, but not when I run jupyter in the docker image.

When I display the svg file, e.g., using and HTML div in a markdown cell, the figures are correct,
so the issue seems to be the IPythib.display.SVG code?

Can anybody tell me what I need to do to get this working?

I wonder if Discourse mangled your posted link? It happened the other day when someone tried posting a complex link, too. Anyway, clicking your link above fails.

I got it to work using the following URL:

For others looking at this, the associated repo is at ea42gh / Elementary Linear Algebra · GitLab

As for you issue. I’m not following 100% what you are trying to point at? It looks like the SVG at the top very top works? And the ones at the bottom, such as after section 1.3, aren’t rendering right in your notebook A2_Matrix_Layout_Displays.ipynb. Is that what you mean?

yes, that is what I mean. Note I am puzzled: the first SVG renders correctly, the next ones do not.
No idea what the differences are.

Thank you for correcting the link!!!

Hi @ea42gh

If you look in the developer tools you can see that the HoloViews logo is a data url. I.e. embedded in the html.

If you look in the developer tools you can see that the svg below is linked to. It’s looking at But cannot find the image there.

Maybe its a Jupyter thing because it’s not serving the image? Maybe its a binder thing due to the reverse proxy. Maybe it’s because you are using “…” in your path?

A workaround could be to convert the svg to a data url. For example Panel seems to do this. So you could probably use panel.pane.SVG to get it working.


Hi @MarcSkovMadsen
Oh, sorry the notebook is fixed to actually render the image!!!
It is


that does not render correctly. h is the file contents wrapped in IPython.core.display.SVG(file_contents)
This normally works fine, but does not work in the docker image!

If I try to use panel, e.g.,

import re
svg_version_re = re.compile('^<\?xml version=[^>]*>' )

with open("../work/figs/f12sym.svg", "r") as f:
    svg = svg_version_re.sub('', )

the result is still messed up. Panel may be using IPython.core.display.SVG internally?

The only workaround I know so far is to display an HTML img