I use stata 14 in Linux mint 19.3. For some reason stata has a problem with the libpng included in Linux mint 19. To fix that, I followed a fix that installs an older version of libpng (see here) to be used with stata. So far so good.

I also use a python script that is launched from within stata via the shell command. This python script calls pdflatex to compile Tex tables generated by stata. Pdflatex called from within stata inherits the libpng stata uses and throws an error. However, if I run the script or pdflatex directly from my terminal it works.

Is there any way to get the shell script launched from within stata to use the default libpng instead of the one stata uses?

I hope that’s clear enough, I am pretty far out of my depth here - thanks for your answers.


OK, so I solved my own problem.

The following addition to the python script fixes my problem:

import os
os.environ['LD_LIBRARY_PATH'] = ''

LD_LIBRARY_PATH is usually empty, but inherits the directory including the old libpng version from stata. If this directory is removed, then it will look in the standard places and find the current version.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.