Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

python - Music21 and MuseScore can't display .png in jupyter notebook

I run this very simple set of commands to display some sheet music:

import music21
music21.environment.set("musescoreDirectPNGPath", "/snap/bin/musescore.mscore")
bwv295 = music21.corpus.parse('bach/bwv295')
bwv295.show()

I am getting the error: SubConverterFileIOException: No png file for /tmp/music21/tmpwh3jnppk.png (such as /tmp/music21/tmpwh3jnppk-1.png) was found. The conversion to png failed

I have made sure to install libpng. I also checked the debug of jupyter and it is saying a couple things:

  • cannot load canberra-gtk-module (I sudo apt-get installed libcanberra-gtk-module)
  • unable to load printer plugin "qtubuntu-print"
  • File "/tmp/music21/tmpwh3jnppk.xml" not found.

screenshot

But, my temp directory definitely contains this file with populated information

Any thoughts?

question from:https://stackoverflow.com/questions/65545641/music21-and-musescore-cant-display-png-in-jupyter-notebook

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The solution here is that musescore was not properly installed. I installed the standalone app and installed it through snap

Turns out you should just install it via the command line, then my sequence of commands will work

sudo add-apt-repository ppa:mscore-ubuntu/mscore3-stable
sudo apt-get update
sudo apt install musescore3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...