Display of music21, musicXML PNG objects using iPython Notebook/Enthought Canopy

I have been grappling with this issue myself. ... Have you set your musicxmlPath in music21? If you have not, it's done via environment.set(key, value). You can query for available keys with environment.keys(). I hope this isn't too simple an answer, but it cleared up the problem for me.


This should be in the iPython music21 documentation somewhere, my apologies: iPython in music21 requires Lilypond to be installed for images to be generated within the notebook itself. There hasn't been (and won't be until MuseScore 2.0 is released) a way using MusicXML to generate PNG images of scores directly.

Edit: 2015 July; music21 2.0 w/ MuseScore 2 will generate the PNG images with MuseScore if it is installed and fallback to Lilypond if it is not installed.


If not yet tried, some steps to isolate the cause of the problem:

1) Update to the latest Canopy (Edit: currently 1.4.1) (might help this, will help generally, won't hurt).

2) Change the Pylab backend in Canopy's IPython shell to "Inline (SVG)", via Preferences / Python. (The default Qt backend in that shell conflicts with music21's use of the tkinter library.)

3) Test your script in that shell rather than in the notebook.

4) Ensure that Canopy User Python is your default Python in a Terminal window, as described here.

5) Test your scripts inside of plain ipython terminal (from Terminal, type ipython).

6) Test in ipython terminal in pylab mode (ipython qtconsole --pylab=inline).

7) Test your scripts inside of ipython notebook running in a regular browser (from Terminal, type ipython notebook, and/or ipython notebook --pylab=inline).