Skip to content
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

Compile ImageMagick with the RSVG delegate enabled #131

Closed
Daltz333 opened this issue Apr 14, 2020 · 9 comments
Closed

Compile ImageMagick with the RSVG delegate enabled #131

Daltz333 opened this issue Apr 14, 2020 · 9 comments

Comments

@Daltz333
Copy link

ImageMagick installed with Ubuntu/Debian does not include RSVG enabled by default. RSVG has to be enabled by compiling ImageMagick with --with-rsvg=yes with all of the various delegates configured and installed.

(Seriously ImageMagick, why do you not have RSVG enabled...)

We are using fairly complex SVGs. Attached is one example (Download and change XML to SVG) https://hastebin.com/tavolodupe.xml

When compiling on RTD, we get a broken output such as black images. This is reproduced on my Ubuntu machine but running magick convert on my Windows machine gives the correct output.

I'm in the process of creating a script to automate the installation of all the various delegates and ImageMagick, but this isn't feasible to deploy on RTD.

@Daltz333
Copy link
Author

I created the following script to configure and install everything for me. https://gist.github.com/Daltz333/3d0d4d04f45fd47604a98b60c2bf15b9

@Daltz333
Copy link
Author

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

@humitos
Copy link
Member

humitos commented Apr 15, 2020

I'm not too familiarized with this problem.

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

Do you have any resource that I can read about this?

I'm not opposite to add this package, but "being used automatically" means that it will affect all the users, and I'm not sure that won't produce unexpected output for them.

@Daltz333
Copy link
Author

ImageMagick6 for Ubuntu does not include RSVG delegate, and the internal SVG delegate seems to give poor accuracy for any SVG I give it.

image

@Daltz333
Copy link
Author

Daltz333 commented Apr 21, 2020

Would it be possible for this package to exist on a per build/project basis?

@amotl
Copy link

amotl commented Sep 15, 2020

Hi there,

we are also observing similar things with ImageMagick (6.9.7-4 croaks while 7.0.10-29 apparently works), so I believe it would be a good idea to share our findings at earthobservations/wetterdienst#155 (comment) with you.

While we will move on with sphinxcontrib-svg2pdfconverter as outlined at earthobservations/wetterdienst#155 (comment), updating the ImageMagick installation will nevertheless make sense.

Most probably, some things will resolve after merging #137.

With kind regards,
Andreas.

Edit: We had no luck even after moving on to sphinxcontrib.rsvgconverter, see earthobservations/wetterdienst#155 (comment).

@humitos
Copy link
Member

humitos commented Sep 24, 2020

Most probably, some things will resolve after merging #137.

@amotl I'm targeting deploying that PR under a testing docker image next week. I'll write a comment here if everything goes smooth asking you for test the new docker image with Ubuntu 20.04 LTS.

rpatterson added a commit to rpatterson/project-structure that referenced this issue Feb 8, 2024
Apparently, [the Debian/Ubuntu build of ImageMagick doesn't enable
RSVG](readthedocs/readthedocs-docker-images#131 (comment))
so we have to use the much larger inkscape dependency:

:1+./.tox/py311/bin/sphinx-build -b latex -Wn -j auto -D autosummary_generate=0 -D autoapi_generate_api_docs=0 ./docs/ ./build/docs/latex/

Extension error:
convert exited with error:
[stderr]
b"convert-im6.q16: unrecognized color `d5d5d5' @ warning/color.c/GetColorCompliance/1057.\nconvert-im6.q16: non-conforming drawing primitive definition `stroke' @ error/draw.c/RenderMVGContent/4404.\n"
[stdout]
b''
make: *** [Makefile:376: build-docs-latex] Error 2
njzjz added a commit to njzjz/deepmd-kit that referenced this issue Apr 19, 2024
Per readthedocs/readthedocs-docker-images#131 (comment), the solution is to install inkscape in the RTD environment.
@njzjz
Copy link

njzjz commented Apr 19, 2024

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

It seems that this issue still exists in 2024. To install Inkscape, one can add inkscape to build.apt_packages:

build:
  apt_packages:
    - inkscape

github-merge-queue bot pushed a commit to deepmodeling/deepmd-kit that referenced this issue Apr 19, 2024
Per
readthedocs/readthedocs-docker-images#131 (comment),
the solution is to install inkscape in the RTD environment.

See error in the log:
https://readthedocs.org/projects/deepmd/builds/24116201/
```
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 59, in convert
    subprocess.run(args, stdout=PIPE, stderr=PIPE, check=True)
  File "/home/docs/.asdf/installs/python/3.11.6/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['convert', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_static/pytorch.svg[0]', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_build/doctrees/images/pytorch.png']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 281, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 307, in build_update
    self.build(['__all__'], to_build)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 376, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 285, in write
    doctree = self.assemble_doctree(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 349, in assemble_doctree
    self.env.resolve_references(largetree, indexfile, self)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 625, in resolve_references
    self.apply_post_transforms(doctree, fromdocname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 637, in apply_post_transforms
    transformer.apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/__init__.py", line 80, in apply_transforms
    super().apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 27, in apply
    self.handle(node)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 244, in handle
    if self.convert(abs_srcpath, destpath):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 67, in convert
    raise ExtensionError(__('convert exited with error:\n'
sphinx.errors.ExtensionError: convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''

Extension error:
convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''
```
github-merge-queue bot pushed a commit to deepmodeling/deepmd-kit that referenced this issue Apr 19, 2024
Per
readthedocs/readthedocs-docker-images#131 (comment),
the solution is to install inkscape in the RTD environment.

See error in the log:
https://readthedocs.org/projects/deepmd/builds/24116201/
```
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 59, in convert
    subprocess.run(args, stdout=PIPE, stderr=PIPE, check=True)
  File "/home/docs/.asdf/installs/python/3.11.6/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['convert', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_static/pytorch.svg[0]', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_build/doctrees/images/pytorch.png']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 281, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 307, in build_update
    self.build(['__all__'], to_build)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 376, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 285, in write
    doctree = self.assemble_doctree(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 349, in assemble_doctree
    self.env.resolve_references(largetree, indexfile, self)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 625, in resolve_references
    self.apply_post_transforms(doctree, fromdocname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 637, in apply_post_transforms
    transformer.apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/__init__.py", line 80, in apply_transforms
    super().apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 27, in apply
    self.handle(node)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 244, in handle
    if self.convert(abs_srcpath, destpath):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 67, in convert
    raise ExtensionError(__('convert exited with error:\n'
sphinx.errors.ExtensionError: convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''

Extension error:
convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''
```
@humitos
Copy link
Member

humitos commented Apr 19, 2024

We don't plan to modify the Docker images we use to build the documentation. Since there is a solution already proposed here by installing Inkscape at build time, I'll proceed to close this issue as not planned.

@humitos humitos closed this as not planned Won't fix, can't repro, duplicate, stale Apr 19, 2024
mtaillefumier pushed a commit to mtaillefumier/deepmd-kit that referenced this issue Sep 18, 2024
Per
readthedocs/readthedocs-docker-images#131 (comment),
the solution is to install inkscape in the RTD environment.

See error in the log:
https://readthedocs.org/projects/deepmd/builds/24116201/
```
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 59, in convert
    subprocess.run(args, stdout=PIPE, stderr=PIPE, check=True)
  File "/home/docs/.asdf/installs/python/3.11.6/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['convert', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_static/pytorch.svg[0]', '/home/docs/checkouts/readthedocs.org/user_builds/deepmd/checkouts/latest/doc/_build/doctrees/images/pytorch.png']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/cmd/build.py", line 281, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 307, in build_update
    self.build(['__all__'], to_build)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 376, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 285, in write
    doctree = self.assemble_doctree(
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/builders/latex/__init__.py", line 349, in assemble_doctree
    self.env.resolve_references(largetree, indexfile, self)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 625, in resolve_references
    self.apply_post_transforms(doctree, fromdocname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 637, in apply_post_transforms
    transformer.apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/__init__.py", line 80, in apply_transforms
    super().apply_transforms()
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
    transform.apply(**kwargs)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 27, in apply
    self.handle(node)
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/transforms/post_transforms/images.py", line 244, in handle
    if self.convert(abs_srcpath, destpath):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/deepmd/envs/latest/lib/python3.11/site-packages/sphinx/ext/imgconverter.py", line 67, in convert
    raise ExtensionError(__('convert exited with error:\n'
sphinx.errors.ExtensionError: convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''

Extension error:
convert exited with error:
[stderr]
b"convert-im6.q16: non-conforming drawing primitive definition `l-1.744' @ error/draw.c/TracePath/6288.\nconvert-im6.q16: non-conforming drawing primitive definition `path' @ error/draw.c/RenderMVGContent/4301.\n"
[stdout]
b''
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants