Help debugging WeBWorK-TikZ image generation

41 views
Skip to first unread message

Sean Fitzpatrick

unread,
Mar 7, 2025, 1:33:40 PMMar 7
to PreTeXt support
I noticed today that I am not getting back images from my WW server for WW problems in source with TikZ in them.

I haven't generated WeBWorK for APEX in awhile, so this isn't necessarily a recent issue.

Whie running WW generation, all of the *-image-1.tgz files are coming back empty from the server.
I regenerated the APEX.pl file in case it was out of date.

I think I need to go into my server to figure out what isn't working, but I forget where I need to check to access logs and temporary image files.
My server is using WW 2.19, so it's possible that the issue is due to the fact that changes to support 2.19 aren't all merged yet.

I've checked that the sample graphics problem included in the WeBWorK problem is loading correctly. (That is, the TikZ in that question is being built by the server.)

Alex Jordan

unread,
Mar 7, 2025, 5:37:18 PMMar 7
to pretext...@googlegroups.com
In your server, the image files are produced at:
/opt/webwork/webwork2/htdocs/tmp/course_name/images/
If image production is successful, you will find them there. 

In pg/lib/LaTeXImage.pm, there is a line that uses `remove_tree` which cleans up temporary files. Comment that out and restart webwork2, and then try to make images if you want the temporary files to persist so you can examine them. I am not 100% sure where the temporary folder for the image building happens though.

/opt/webwork/webwork2/logs/webwork2.log
is where I think you would find error log messages from LaTeXImage.pm

Since the sample chapter image is working for you, I wonder if it is something about bad syntax in APEX.pl. Some characters in your latex-image-preamble may need special attention to work for PG in addition to just working for tex output directly. For example, always use \(...\), not $...$, in latex-image-preamble. There may be other things like that that I am blanking on for now.




--
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/0339ec15-602e-4bb7-889a-4ebd211e7a72n%40googlegroups.com.

Sean Fitzpatrick

unread,
Mar 7, 2025, 6:39:56 PMMar 7
to pretext...@googlegroups.com

Thanks. To clarify, I meant that if I log into WeBWorK and open a .pg file with TikZ in it, it renders correctly.

I just tried building the sample chapter against my server. I'm not seeing any warnings about missing images, but a few problems aren't building successfully on my server: 62, 63, 64, 65, 67, and 68. I'm not sure which ones these are.
I'll try to find some time to dig around later.


Alex Jordan

unread,
Mar 7, 2025, 7:01:29 PMMar 7
to pretext...@googlegroups.com

It may help to put labels on exercises, and then I think you will be more easily able to locate the corresponding source.


Sean Fitzpatrick

unread,
Mar 7, 2025, 8:10:27 PMMar 7
to pretext...@googlegroups.com
That's what I do, but this was just a test run against the WeBWorK sample chapter in the pretext repo to see what it would do. 
The sample chapter doesn't have labels on its exercises.

Sean Fitzpatrick

unread,
Mar 12, 2025, 4:53:42 PMMar 12
to PreTeXt support
I checked the /opt/webwork/webwork2/htdocs/tmp/apex/images folder, and what is strange is that there is precisely one .tgz file there.
There should be many. I don't see anything helpful in the log file.

I also copied some of the generated .pg source files in the webwork-representations file, and pasted them into the problem editor on WeBWorK.
Images are rendering just fine.

I am wondering if images are going to the wrong tmp directory, and pretext can't find them.
I commented out some lines in localOverrides.conf that set temporary directories and restarted webwork2.

Good: now I am getting lots of .tgz files in the tmp/apex/images folder. And they are *not* empty.
Bad: despite the fact that these are being created, and contain what they're supposed to contain, I'm still getting the following sort of thing every time there's a TikZ image in a WW problem:
WARNING : C:\Users\Sean Fitzpatrick\Documents\github\APEXCalculusPTX\generated-assets\webwork\images\webwork-ex-limit-intro-numerical-graphical-3-image-1.tgz did not contain a .tex file
WARNING : C:\Users\Sean Fitzpatrick\Documents\github\APEXCalculusPTX\generated-assets\webwork\images\webwork-ex-limit-intro-numerical-graphical-3-image-1.tgz did not contain a .pdf file
WARNING : C:\Users\Sean Fitzpatrick\Documents\github\APEXCalculusPTX\generated-assets\webwork\images\webwork-ex-limit-intro-numerical-graphical-3-image-1.tgz did not contain a .svg file
WARNING : C:\Users\Sean Fitzpatrick\Documents\github\APEXCalculusPTX\generated-assets\webwork\images\webwork-ex-limit-intro-numerical-graphical-3-image-1.tgz did not contain a .png file

Sean Fitzpatrick

unread,
Mar 12, 2025, 5:00:46 PMMar 12
to PreTeXt support
AHA!! The plot thickens.

This is not a problem with my server. It has something to do with how this part of the script is running on Windows machines.
If I run 'pretext generate webwork -t html', using CLI 2.14.0 on a Linux computer, everything works just fine.
But doing the same on Windows (with the same CLI version) leads to missing images.

Oscar Levin

unread,
Mar 12, 2025, 5:23:22 PMMar 12
to pretext...@googlegroups.com
That is very strange that there is a different behavior for windows than linux.  Can you send the log file from that pretext run?

Sean Fitzpatrick

unread,
Mar 12, 2025, 6:08:00 PMMar 12
to pretext...@googlegroups.com

I've just left my office! (And the computers contained therein.) But I'll send you the log files tomorrow.

I can download the .tgz files from the server onto my Windows computer, and open them, and confirm that they have contents. So I'm not sure why pretext thinks they're empty.


Sean Fitzpatrick

unread,
Mar 13, 2025, 10:46:14 AMMar 13
to PreTeXt support
Here is a recent log file. I checked logs from around this time last year, and I was getting clean runs on everything.
Going back, I am seeing this problem with CLI 2.12 in January, and perhaps I didn't notice it, but 2.6.2 ran into the same issue last September, and 2.4.0 last May.

I think something changed in Windows, because I have a clean run using 2.3.9 on April 12, 2024, and a failed run on April 18, 2024, also using 2.3.9.
(I can't think of any reason why I would have made changes to the WeBWorK server around that time.)
That would have been right at the end of term, at which point I would have abandoned my Windows computer for Linux for the summer.

20250312-143613.log

Oscar Levin

unread,
Mar 13, 2025, 11:54:00 AMMar 13
to PreTeXt support
Thanks.  I'ts frustrating that the log didn't show anything helpful.  Could you try again with -v debug set?  (so pretext -v debug generate....)

The other thing I'd like to try is to check whether you have developer mode enabled.  See https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development#activate-developer-mode.  If you can, try enabling it and maybe the problem goes away.  This doesn't solve the main issue, but might help me figure out how to make it work better.

Sean Fitzpatrick

unread,
Mar 13, 2025, 4:41:40 PMMar 13
to PreTeXt support
Here is a log file with debugging turned on.
I don't have developer mode enabled (yet).
That's the next thing to try.

20250313-141751.log

Sean Fitzpatrick

unread,
Mar 13, 2025, 4:45:22 PMMar 13
to PreTeXt support
Trying to open developer settings crashes the Windows settings app... Le sigh.

Sean Fitzpatrick

unread,
Mar 13, 2025, 8:52:44 PMMar 13
to PreTeXt support
OK, a reboot and developer settings are on. But I'm still not getting images from the .tgz files.
Reply all
Reply to author
Forward
0 new messages