Prefigure Error that Module not found, but prefigure is installed

15 views
Skip to first unread message

Matt Wechter

unread,
Jun 2, 2026, 2:20:41 PMJun 2
to PreTeXt support
I get an error running pretext build print command that

error: Unable to generate some prefigure images:
error:  PTX ERROR: the "prefig" module has failed to load, and
error:   this is necessary for the task you have requested.  Perhaps
error:   you have not installed it?  Or perhaps you have forgotten to
error:   use a Python virtual environment you set up for this purpose?

But I can run prefig on the images individually and it works, so I know prefigure is on the computer downloaded with pipx.  This is with Pretext 2.40.2 on Ubuntu WSL on my Windows machine.  

I'm not getting these errors with a pretext build web command

David Austin

unread,
Jun 2, 2026, 2:38:35 PMJun 2
to pretext...@googlegroups.com
I'm definitely not an expert with WSL, but could a virtual environment be an issue?  That is, is pretext installed in a virtual environment and prefig in a different environment?

David

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/b4cd74cb-7da8-4a6b-a914-1cb640511547n%40googlegroups.com.

Oscar Levin

unread,
Jun 2, 2026, 3:01:42 PMJun 2
to pretext...@googlegroups.com
I don't really understand pipx, but I think it creates a virtual environment for just the package you are installing.  So maybe `pipx install pretext` and `pipx install prefig` can't talk to each other.  There is a way to add a package to an existing virtual environment created with pipx.  Alternatively, try `pipx install pretext[all]` which will include prefigure as a dependency.

Matt Wechter

unread,
Jun 2, 2026, 4:24:10 PMJun 2
to PreTeXt support
Using pretext[all] takes me down a rabbit hole.  There's a problem in the case with pycairo

pip seemed to fail to build package:
    pycairo<2.0,>=1.20

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    ../cairo/meson.build:31:12: ERROR: Dependency lookup for cairo with method 'pkg-config' failed: Pkg-config for machine host machine not found. Giving up.
    error: metadata-generation-failed


And if I try to install pycairo separately with pip or pipx there are more errors.  I think this is why I originally only installed pretext and not pretext[all], but now I need prefigure working for my project.  Is there a way to run the prefigure files separately and just have my pretext project call to the output?

David Austin

unread,
Jun 2, 2026, 4:38:55 PMJun 2
to pretext...@googlegroups.com
You can try installing pycairo following instruction 3 here.

Alternatively, pycairo is only needed for plain text labels, meaning labels that are not inside <m> elements so if you don't have labels like that, then you'll be fine.  

Matt Wechter

unread,
Jun 2, 2026, 4:50:11 PMJun 2
to PreTeXt support
Thanks.  I'm making progress.  I had to download cairo first before pycairo.  Now I'm just having problems with something called rsvg-convert for the prefigure images.  Almost there!

David Austin

unread,
Jun 2, 2026, 5:01:58 PMJun 2
to pretext...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages