alwaysCurious
alwaysCurious

Reputation: 537

tikz in ipython notebook: no drawing created. Instead, get message "No image generated."

I have installed tikzmagic.py (https://github.com/mkrphys/ipython-tikzmagic/tikzmagic.py) in ~/.ipython/extensions on a mac os x 10.10.4 laptop with Anaconda (python 2.7.10), ipython/jupyter 4.0, and TexLive-2015. In a jupyter notebook when I execute "%load_ext tikzmagic" and then "%tikz \draw (0,0) rectangle (1,1);" I do not get a rectangle as the output. Instead I get the message "No image generated." I get the same result when I run in a different conda environment with ipython 3.2.

I have an older laptop running Mac OS X 10.9.4 with LiveTeX-2014 and it works fine there with ipython 3.2. I have checked the PATH variable on my current laptop and on my older laptop. The only difference is on my current laptop "/Library/TeX/texbin" is in PATH, whereas on my older laptop "/usr/texbin" is in PATH. pdflatex, which is called on line 109 of tikzmagic.py is in both of these directories so I don't think that's the problem.

Also, when I run TeXShop 3.51 and use tikz in a latex document, it works fine. I am really puzzled as to what's going on.

Upvotes: 3

Views: 3063

Answers (1)

alwaysCurious
alwaysCurious

Reputation: 537

It turns out that tikzmagic needs the ImageMagick and pdf2svg packages, which were not installed on my newer laptop. After installing them, tikzmagic works fine in my jupyter notebooks. The tikzmagic author, who was very responsive (see github issue), has updated the README on github to mention these dependencies.

In case it's helpful, here are the detailed steps I took:

  1. Install homebrew:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  2. Install ImageMagick:

    brew install ImageMagick

  3. Install poppler (a dependency of pdf2svg):

    brew install poppler

  4. Install pdf2svg:

    brew install pdf2svg

Upvotes: 2

Related Questions