Forums

pnglatex and pnm2png

Hello everyone. I was wondering if someone could help me with an issue I am having here.

I have created a program with a feature that converts latex code into a .png image.

To do this, I use a pypi program called pnglatex.

https://pypi.org/project/pnglatex/

To have this feature work on Pythonanywhere, the pypi page says I need to have a LaTeX distribution installed such as TeX Live or MiKTeX as well as 3 programs called pdfcrop, pnmtopng, and pdftoppm.

On my home computer, I utilize the sudo apt install command to install these programs and all is working, but I cannot use the sudo apt install command on Pythonanywhere.

Therefore, it seems I don't have these programs installed on Pythonanywhere. The error log is telling me:

"ValueError: Eexecutable pnm2png not found"

Is there a way that I can install this required program?

I believe on Ubuntu the package is called pnmtopng and it's not currently installed. I created a ticket for that and we'll try to install it in the next system image. Meanwhile you can try installing it by yourself from source, but we can't guarantee that it would work. You'd need to find the Ubuntu package for that executable and then try to install it locally with dpkg -x command.

UPDATE: We added support for pnmtopng by installing netpbm package to our new system image, "haggis", see this blog post for more information.