Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise TypeError("Inkscape svg to pdf conversion failed") #302

Closed
charlesdavid opened this issue May 2, 2016 · 12 comments
Closed

raise TypeError("Inkscape svg to pdf conversion failed") #302

charlesdavid opened this issue May 2, 2016 · 12 comments

Comments

@charlesdavid
Copy link

Not sure why I can not use jupyter nbconvert to get a pdf... and why there is a reference to a stand alone application Inkscape? I need to share my notebooks with collaborators in and easy way. Those folks think advanced programming is opening Excel. I can not save notebooks larger than 50mb, which eliminates all graphical output. So, I need a turnkey solution to output the entire NB, graphics and all, and send it to the other folks. What is the EASY-SIMPLE-SOLUTION_WORKABLE to share NBs that have embedded graphics and thus are 100mb or more?

@takluyver
Copy link
Member

Inkscape is used if there are SVG images, because those can't be used directly in Latex (as far as I know), so they have to be converted to a format that can. Inkscape is the most practical way we know to do that.

In general, I think the 'easiest' format to convert to for sharing is HTML - that doesn't require any external programmes to help with the conversion. It may be a bit slow with large notebooks with a lot of embedded images, though.

@cschwem2er
Copy link

The same happens when trying to convert R notebooks with the IR Kernel to PDF. I usually also prefer HTML, but this does not work well with the R kernel either (the plots are sometimes cutoff, sometimes empty).

@jankatins
Copy link
Contributor

For irkernel, try running

options(jupyter.plot_mimetypes = c("text/plain", "image/png" )) # no more svg...

This removes svg from the produces images...

@soamaven
Copy link

soamaven commented Jun 29, 2016

Should .svg conversion be transparent when using jupyter nbconvert --to pdf My_Notebook.ipynb? I am getting the same error as in title, and I definitely have inkscape in my path.

getting:
! LaTeX Error: Unknown graphics extension: .svg.
presumably from pandoc
Using:
nbconvert==4.2.0
notebook==4.2.1
pandoc==1.15.0.6

@takluyver
Copy link
Member

Is there any error message from Inkscape that might indicate what went wrong? We raise the error in the title when the output file we asked Inkscape to create is not present.

@soamaven
Copy link

soamaven commented Jun 29, 2016

I apologize, I actually do not get that specific error, I am getting the error that .svg cannot be converted. I meant "same error" as in "I have a similar problem". My apologies for the miscommunication, I'll aim to be more precise next time. Perhaps I should open a new issue?

I get no errors from Inkscape at all. The only error I get is
! LaTeX Error: Unknown graphics extension: .svg.
and then the conversion bows-out. It should be able to find it:

[user@local] $ which inkscape
/usr/bin/inkscape

@takluyver
Copy link
Member

Yes, SVGs should be converted automatically. If it was failing to find inkscape, you would get a different error ("Inkscape executable not found"). The automatic conversion currently only works for SVG outputs, however - SVGs in markdown cells are not handled.

@soamaven
Copy link

soamaven commented Jun 29, 2016

Ahh. This is the issue then -- the .svg files are referenced in markdown cells.

I guess I can manually convert them to .pdf and use those in the markdown cells. I will leave this up to Project Jupyter to decide if this should be handled automatically in markdown cells also. I'd vote yay, but I know there are probably more pressing things to deal with. Thank you.

@mseri
Copy link

mseri commented Dec 6, 2018

I have been hit by the same "missing inkscape" issue. Both convert from imagemagick and rsvg-convert can convert svg to pdf (and are much lighter than having to install inkscape), would you be interested into a PR that checks if any of those is available for the conversion?

@mgeier
Copy link
Contributor

mgeier commented Dec 6, 2018

As an alternative, when using nbsphinx to generate the LaTeX/PDF output, the existing Sphinx infrastructure can be used to automatically convert SVG images to PDF images, see https://nbsphinx.readthedocs.io/en/latest/markdown-cells.html#SVG-support-for-LaTeX.

At some point this will hopefully also be available on readthedocs.org, see readthedocs/readthedocs-docker-images#79.

@terminal-w
Copy link

Would it be possible to update svg2pdf.py so that it checks the System Path for Inkscape before the Registry? I can't find how to check if a shell command will execute without actually executing it.

With the latest install of inkscape HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\inkscape.svg does not exist in my registry.
The only registry reference I have for inkscape is : Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe
I think more windows users are comfortable to edit the system path especially if they want their anaconda distro to be accessible to other apps or at least the path is less scary than the registry.

@t-makaro
Copy link
Contributor

t-makaro commented Aug 1, 2019

A few different issues are present on this thread. I'm going to close this issue in favour of some other individual issues to help us organize this better. If your SVG issue does not fall into one of the following issues, then please open a new issue.

#885: Allow an alternative/fallback to inkscape.
#244: SVG images in markdown not converted.
#585: Inkscape not found when in system path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants