Lilypond: command not found error

I have installed abjad, Lilypond. I am using virtualenv in PyCharm. When I want to show/create the pdf with Lilypond it says: “lilypond: command not found”… Lilypond is in PATH and when I run “lilypond” in Powershell or in the PyCharm terminal it shows the help command of lilypond. Only scamp or abjad is not recognizing the installation… I am using Windows 10

My error message:

WARNING:root:python-rtmidi was not found; streaming midi input / output will not be available.
WARNING:root:pynput was not found; mouse and keyboard input will not be available.
Using preset Piano Merlin for piano
fluidsynth: error: no MIDI in devices found
Der Befehl "lilypond" ist entweder falsch geschrieben oder konnte nicht gefunden werden. [FROM GERMAN TO ENGLISH: The command "lilypond" is either misspelled or could not be found.]



Process finished with exit code 0

My code looks like this:

from scamp import *

pitch = 1

s = Session()

s.fast_forward_to_beat(255)
piano = s.new_part("piano")

s.start_transcribing()

i = 0
while i < 2:
    piano.play_note(pitch, 1, 0.05)
    if pitch < 127:
        pitch += 1
    else:
        pitch = 0
        i += 1

performance = s.stop_transcribing()
performance.to_score().show()

Are you using the most recent SCAMP?

Try running:

from scamp import engraving_settings
engraving_settings.lilypond_search_paths
print(engraving_settings.lilypond_dir)

What do you get?

It prints out C:\Program Files\Lilypond\lilypond-2.24.1\bin, which is also in PATH

Hmm… strange. SCAMP is finding LilyPond, and since it’s in PATH it shouldn’t even need to.

It must be an issue with Abjad, but I have no idea how to fix that.

In the meantime, you know that you can do show_xml or export_to_xml to get notation, right?

Yes, but then I have install a music script viewer. :confused: . But still thanks for your time…

Hi I had this problem on Windows and was able to get it to work by putting the specific path to lilypond in the Abjad conf file
Abjad config file was in my user dir as per (Configuration — Abjad 3.17 documentation)
Then found the lilypond_path setting and specified it like:

# Lilypond executable path. Set to override dynamic lookup.
lilypond_path = "C:\Program Files (x86)\lilypond-2.24.1\bin\lilypond.exe"

Hope this helps!

Brilliant, thanks for chiming in!

I’m having the same problem, on Windows 11. I don’t know how to put the specific path to lilypond in the Abjda conf file. I can’t find the ~/.abjad directory (I told Windows to show hidden files, and it didn’t help).

If the ~/.abjad directory doesn’t exist, I don’t know how to force Abjad to run so it gets created.

I can provide more details if you want.

Hi!
So you have checked your user directory ( C:\Users[your user name]) for the .abjad dir?
I think it appeared there for me after running through the setup as described by marc here: http://scamp.marcevanstein.com/narrative/easy_setup.html

AndyP:

Thanks for the quick response!

I followed the Easy Setup instructions as described in that link.

I’m using Windows 11. In the directory
C:\Users\afery\AppData\Roaming\Python\Python310\site-packages , there are directories called abjad and abjad-3.18.dist-info . I can’t find .abjad (with a period), even when searching the subfolders of \sitepackages and telling Windows Explorer to show hidden files.

The abjad folder contains a file called configuration.py . I tried adding your line to it, but was unsure where to do it. I tried a few places, and got a few different errors when I ran Marc’s test script.

When I run Marc’s test script, the right sounds are produced but I don’t see a pdf of the score. I get these warnings and errors:

WARNING: Your `C:\Users\afery\AppData\Roaming\Python\Python310\site-packages\abjad\io.py` can shadow the library module 'io'. Consider renaming or moving it!

WARNING: Your `C:\Users\afery\AppData\Roaming\Python\Python310\site-packages\abjad\string.py` can shadow the library module 'string'. Consider renaming or moving it!

fluidsynth: error: no MIDI in devices found
'lilypond' is not recognized as an internal or external command,
operable program or batch file.

I can run lilypond on its own (outside of SCAMP) and its works fine.

You could try an exhaustive search for the config? Its called abjad.cfg by opening up a terminal window making sure you are in the root (so at the C:\ prompt) and type: dir abjad.cfg /s
It might take a little bit as it does a recursive search of all dirs on your c drive but that way we can establish whether its somewhere on your c drive…

Also I just double checked the version of abjad I installed which is an earlier version : 3.4, which may make a difference. So the other thing you could try is downgrading the abjad version in the package manager

Installed version: 3.4

Thanks again for the quick reply! I followed your advice and I found the directory. Thanks.

Details:
Using Power Shell and typing your command, Windows told me instantly that the file or directory didn’t exist. So I tried “dir abjad.cfg -r” and it showed me C:\Users\afery.abjad . I hadn’t looked for .abjad in \afery : I thought it would be where the installer said abjad was installed, which is where it does appear to be installed.

Tomorrow I"ll try adding the path to lilypad as you have suggested. Eventually I may do something similar for MIDI, since SCAMP routinely gives similar error messages about MIDI.

I just saw your idea about downgrading abjad. I’ll keep it in mind if I can’t get things to work using the current version.

Just to chime in here: The most recent version of scamp (0.9.2) works only with the latest version of abjad. Earlier versions only work with abjad 3.4. Abjad keeps changing, and new versions are not backwards compatible, which makes it a bit of a pain to keep up with. The versions after 3.4 required python 3.10, which I resisted for a while, but now the latest scamp also depends on that.

1 Like

Thanks Marc!
Yes I have just updated to the latest SCAMP (0.9.2) and latest Abjad (3.18) and can confirm that using the test script it runs and the PDF shows (with the lilypond_path line in the abjad.cfg file)
So if spradlig sees this , there is no need to downgrade the abjad version.
Cheers

1 Like

I finally get abjad to work, by using your suggestions. The pdf of the score pops up after I run the test script in thonny. Thanks!

For some reason, I had a lot of trouble finding abjad.cfg, even after finding the right directory.

I still get the error “fluidsynth: error: no MIDI in devices found”, but I don’t need to fix that right away.

Everything was working fine 6 days ago, but now I can’t get SCAMP to produce the pdf. I don’t think I changed anything. When I run the test script

from scamp import test_run test_run.play(show_lilypond=True) ,

I get the same error as before:

'lilypond' is not recognized as an internal or external command, operable program or batch file.

lilypond works fine when I use frescobaldi outside of SCAMP. My Windows 11 path includes the line C:\Program Files (x86)\lilypond-2.24.1-mingw-x86_64\lilypond-2.24.1\bin. My configuration file for abjad, which has full address/path "C:\Users\afery\.abjad\abjad.cfg" , contains

# Lilypond executable path. Set to override dynamic lookup.
lilypond_path = "C:\Program Files (x86)\lilypond-2.24.1-mingw-x86_64\lilypond-2.24.1\bin\lilypond.exe" .
e

I don’t need the pdf output urgently, but it would be nice to get it to work eventually. Along with midi.

@AndyP

Hey @spradlig , that does seem strange if you haven’t change anything
I can see a few extraneous characters after your file path ie the “.” and the “e”.
So firstly just double check nothing extra has crept in…so from your details it should be:

# Lilypond executable path. Set to override dynamic lookup.
lilypond_path = "C:\Program Files (x86)\lilypond-2.24.1-mingw-x86_64\lilypond-2.24.1\bin\lilypond.exe"

Here is mine - with a different path to lilypond - just for ref

# Lilypond executable path. Set to override dynamic lookup.
lilypond_path = "C:\Program Files (x86)\lilypond-2.24.1\bin\lilypond.exe"
1 Like

Thanks. I just double-checked the config file. Nothing extra has crept in to the line beginning “lilypond_path”. The extra characters are a typo in my post on this forum. Sorry.

Hi all,

Absolute newbie, to SCAMP, not music or computers.

On Windows 10:

Lilypond works with Frescobaldi but not with Thonny. Can someone please give me some really simple 1,2,3 guidance. (I don’t know anything about .cfg files in this installation… just installed everything an hour ago.) Thanks so much.