Interactive preview images failing

8 views
Skip to first unread message

Kyle Monette

unread,
Jul 8, 2026, 2:10:17 PM (13 hours ago) Jul 8
to PreTeXt support
Hi all,

I noticed that preview images are not being generated for interactives in my book when building to a pdf document ("print"). Namely, jsxgraph images. I attempted the following command:
pretext generate -t print interactive

For some context -- I downloaded pretext on my Mac using pipx, and I'm using version 3.14 of Python. I have version 2.43.2 of Pretext (just upgraded today).

This appears to be an issue with Python 3.14. In particular, in the pretext/pretext/lib/pretext.py file, at line 1976 (linked here). According to some research, asyncio.get_event_loop() would implicitly create a new event loop in older Python versions if none existed in the current thread. This has since been deprecated.

The good news is that I have what appears to be a simple solution. Following the link above to the pretext.py file, one only needs to replace:
asyncio.get_event_loop().run_until_complete
with the following:
asyncio.run

Regretfully I don't have the confidence to submit an issue or PR to GitHub and have it actually be correctly done (and useful), for which I apologize. Learning Git has been on my bucket list :) 

- Kyle


Rob Beezer

unread,
Jul 8, 2026, 2:35:29 PM (12 hours ago) Jul 8
to pretext...@googlegroups.com
Dear Kyle,

Will .run() behave with older versions of Python? In other words, when was it
first introduced?

It was only this week that we moved to 3.10 as the minimum Python version for
these routines.

(No, we are not opening a discussion about how old or how new 3.10 is, I know
exactly what the situation is.)

Rob

On 7/8/26 11:10, 'Kyle Monette' via PreTeXt support wrote:
> Hi all,
>
> I noticed that preview images are not being generated for interactives in my
> book when building to a pdf document ("print"). Namely, jsxgraph images. I
> attempted the following command:
> pretext generate -t print interactive
>
> For some context -- I downloaded pretext on my Mac using pipx, and I'm using
> version 3.14 of Python. I have version 2.43.2 of Pretext (just upgraded today).
>
> This appears to be an issue with Python 3.14. In particular, in the pretext/
> pretext/lib/pretext.py file, at line 1976 (linked here <https://github.com/
> PreTeXtBook/pretext/blob/e4dc1200082d23ceedd47f9cfa14f38d189a3cbb/pretext/lib/
> pretext.py#L1976>). According to some research, asyncio.get_event_loop() would
> implicitly create a new event loop in older Python versions if none existed in
> the current thread. This has since been deprecated.
>
> The good news is that I have what appears to be a simple solution. Following the
> link above to the pretext.py file, one only needs to replace:
> asyncio.get_event_loop().run_until_complete
> with the following:
> asyncio.run
>
> Regretfully I don't have the confidence to submit an issue or PR to GitHub and
> have it actually be correctly done (and useful), for which I apologize. Learning
> Git has been on my bucket list :)
>
> - Kyle
>
>
> --
> 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 <mailto:pretext-
> support+u...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> support/02a19363-f43b-49d0-8bf7-0f49ae364736n%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-support/02a19363-
> f43b-49d0-8bf7-0f49ae364736n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Kyle Monette

unread,
Jul 8, 2026, 2:44:14 PM (12 hours ago) Jul 8
to PreTeXt support
Hi Rob,

It seems it was added in version 3.7, according to this page

Reply all
Reply to author
Forward
0 new messages