-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageMagick failure on Ubuntu 18.04 #67
Comments
Probably related, this is also causing issues when using SWAN (both python3 and legacy python stacks): ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-5-58ae0b37a4f9> in <module>
3 table.add_variable(exp)
4 submission.add_table(table)
----> 5 submission.create_files("example_output")
~/.local/lib/python3.6/site-packages/hepdata_lib/__init__.py in create_files(self, outdir)
478 # Write all the tables
479 for table in self.tables:
--> 480 table.write_output(outdir)
481
482 # Copy additional resource files
~/.local/lib/python3.6/site-packages/hepdata_lib/__init__.py in write_output(self, outdir)
229 :type outdir: string
230 """
--> 231 self.write_images(outdir)
232 self.write_yaml(outdir)
233
~/.local/lib/python3.6/site-packages/hepdata_lib/__init__.py in write_images(self, outdir)
251 command = "convert -flatten -fuzz 1% -trim +repage {} {}/{}".format(
252 image_file, outdir, out_image_file)
--> 253 command_ok = helpers.execute_command(command)
254 if not command_ok:
255 print("ImageMagick does not seem to be installed \
~/.local/lib/python3.6/site-packages/hepdata_lib/helpers.py in execute_command(command)
35 for line in proc.stderr:
36 result = result + line
---> 37 raise RuntimeError(result)
38 return True
39
RuntimeError: convert: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/714.
convert: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/714.
convert: FailedToExecuteCommand `'gs' -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' '-sOutputFile=/tmp/magick-400EDeqaEdlyWFq%d' '-f/tmp/magick-400p772kieSgsyo' '-f/tmp/magick-400wdnbYQGQ4Erm'' (1) @ error/pdf.c/InvokePDFDelegate/291.
convert: NoImagesDefined `example_output/Figure_006-a.png' @ error/convert.c/ConvertImageCommand/3275. |
I tried running the image conversion also in our tests in #73, but the conversion fails like this:
While that error looks like there is a missing file, I do not think that that is possible, since our code explicitly checks the existence of the file before running the command. |
(It does succeed starting from a PNG, though. Only PDF inputs fail.) |
There seems to be an issue with
convert
failing on Ubuntu 18.04. If you see errors like this one:you can check out this fix on stackoverflow. It seems that ImageMagick now prohibits certain operations by default to avoid security vulnerabilities due to malicious code embedded in certain media files. Unfortunately, the fix requires the user to edit the policy file
/etc/ImageMagick-6/policy.xml
, which requires admin privileges. I am not sure what exactly triggers the issue, so it's hard to say how many users will be affected. If this becomes a widespread problem, we should look into replacing our use of ImageMagick with something else.The text was updated successfully, but these errors were encountered: