How to edit ImageMagick's policy.xml file in a deployed Streamlit app?

Blockquote

Hi,

I created an app using Streamlit that uses ImageMagick and moviepy. The app runs fine on my local system. But when I deploy the app on Streamlit’s Community Cloud, I get the following error:

OSError: MoviePy Error: creation of None failed because of the following error:

convert-im6.q16: attempt to perform an operation not allowed by the security policy @/tmp/tmp6ca_nccx.txt' @ error/property.c/InterpretImageProperties/3708. convert-im6.q16: no images defined PNG32:/tmp/tmplzoyr257.png’ @ error/convert.c/ConvertImageCommand/3229.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn’t specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect

I’d initally got the same error on my local machine, and the fix was to change ImageMagick’s policy.xml file manually. After the file was edited, the error no longer appeared.

My question is, how can I access ImageMagick’s policy.xml file if the app is deployed on Streamlit’s Community Cloud? I’ve already tried uploading the new policy.xml on GitHub and setting the environment variable MAGICK_CONFIGURE_PATH = “/.magick” with the policy.xml file being inside the .magick folder, but it doesn’t work.

Can someone help out? Thanks a lot!

Do you have imagemagick listed in your packages.txt file?

Yes, the packages.txt file lists out imagemagick. I think it’s being installed correctly. But the default installation’s policy.xml needs to be changed for the code to work. Would you know how that can be done?