Opened 8 years ago
Closed 7 years ago
#15225 closed defect (duplicate)
dot2tex breaks Poset.show()
Reported by: | jmantysalo | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
Component: | packages: optional | Keywords: | poset, dot2tex |
Cc: | strogdon | Merged in: | |
Authors: | Reviewers: | Travis Scrimshaw | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
var('a,b,c,d,e,f,g,h') THISFAILS=Poset( ( [h, g*h, f*h, e*h, d*e*h, c*e*h, b*e*h, a*b*c*d*e*f*g*h], [[h, g*h], [h, f*h], [h, e*h], [g*h, a*b*c*d*e*f*g*h], [f*h, a*b*c*d*e*f*g*h], [e*h, d*e*h], [e*h, c*e*h], [e*h, b*e*h], [d*e*h, a*b*c*d*e*f*g*h], [c*e*h, a*b*c*d*e*f*g*h], [b*e*h, a*b*c*d*e*f*g*h]]), cover_relations = True, facade = False) THISFAILS.show()
gives
AttributeError?: 'str' object has no attribute 'iteritems'
Change History (20)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
I can not confirm this bug. Both the plots work in sage-5.10, sage-5.11.rc0 and sage-5.13.beta1.
What version of sage are you using? Can you try some recent versions?
comment:3 Changed 7 years ago by
- Status changed from new to needs_info
comment:4 Changed 7 years ago by
Last example was tested with 5.12. For example
Poset([ [1,2,3], [[1,2],[2,3]] ]).show()
works, so system itself seems to work. sage.misc.package.optional_packages() says
(['autotools-20121217', 'beautifulsoup-3.2.1', 'benzene-20130630', 'biopython-1.61', 'buckygen-1.0', 'cbc-2.8.1.p0', 'ccache-3.1.9', 'chomp-20130518.p1', 'cluster_seed-1.0', 'coxeter3-1.1', 'cryptominisat-2.9.6', 'cunningham_tables-1.0', 'database_cremona_ellcurve-20121022', 'database_gap-4.6.4', 'database_jones_numfield-v4', 'database_kohel-20060803', 'database_odlyzko_zeta', 'database_pari-20130516', 'database_sloane_oeis-2005-12', 'database_stein_watkins_mini.p0', 'database_symbolic_data-20070206', 'dot2tex-2.8.7.p2', 'extra_docs-20070208', 'gap_packages-4.6.4.p1', 'gcc-4.6.4', 'gdbm-1.8.3', 'ginv-1.9-20080723', 'git-1.7.12.2.p0', 'gnuplotpy-1.8', 'guppy-0.1.8', 'java3d-20070901', 'kash3-2008-07-31.p0', 'knoboo-20080411', 'libogg-1.1.4', 'lie-2.2.2.p5', 'lrs-4.2b.p1', 'mpi4py-1.2.2', 'nauty-25', 'normaliz-2.8.p0', 'nose-1.1.2', 'nzmath-1.1.0', 'openmpi-1.4.3', 'openssl-1.0.1c.p0', 'p_group_cohomology-2.1.4', 'phc-2.3.65.p0', 'pybtex-20120618', 'pycryptoplus-20100809-git', 'pyopenssl-0.13.p0', 'PyQt_x11-4.9.1.p0', 'pyx-0.10', 'pyzmq-2.1.11.p1', 'qhull-2010.1', 'sage_mode-0.9.1', 'sip-4.13.2.p0', 'TOPCOM-0.17.4', 'trac-0.11.5.p0', 'valgrind-3.8.1.p0', 'zeromq-3.2.0.p0'], ['4ti2-1.6', 'brian-1.4.1.p0', 'fricas-1.0.9', 'fricasaldor-1.0.9', 'jsmath_image_fonts-1.4.p3', 'libcocoa-0.9930', 'libtheora-1.1.1', 'patchbot-2.0'])
There is also ldap installed on system, but I guess that it doesn't make any differense.
I will compile plain sage-5.12 to see if this happens without packages.
comment:5 Changed 7 years ago by
I downloaded sage-5.12-linux-64bit-fedora_release_16_verne-x86_64-Linux.tar.lzma and show() command works. Then I installed gnuplotpy-1.8 and it still works. But after sage.misc.package.optional_packages() if fails. Any ideas about what package to test?
comment:6 Changed 7 years ago by
Found it. dot2tex-2.8.7.p2 breaks this.
comment:7 Changed 7 years ago by
- Summary changed from Poset.show gives error 'str' object has no attribute 'iteritems' to dot2tex breaks Poset.show()
comment:8 Changed 7 years ago by
- Component changed from graphics to packages: optional
- Keywords dot2tex added
comment:9 follow-up: ↓ 10 Changed 7 years ago by
Same happens with 5.13.beta1 and dot2tex-2.8.7.p2.spkg. Does this still needs more info?
comment:10 in reply to: ↑ 9 Changed 7 years ago by
Replying to jmantysalo:
Same happens with 5.13.beta1 and dot2tex-2.8.7.p2.spkg. Does this still needs more info?
Of course not! Thanks for tracking it down. I have still kept it at needs info because there is no other better status to set it to.
comment:11 Changed 7 years ago by
- Status changed from needs_info to needs_work
- Work issues set to fix dot2tex
Ok. Let's set it to needs work. dot2tex needs to be fixed.
comment:12 Changed 7 years ago by
Do you have graphviz
installed on your system?
The (the optional package) dot2tex
stuff [typically] needs graphviz
installed as well, but there's no check for that in Sage AFAIK. So if you have dot2tex
installed but not graphviz
, you can get things breaking because things that check for dot2tex
pass and it expects graphviz
to be there as well..
comment:13 Changed 7 years ago by
At least on one system with this problem dpkg says "ii graphviz 2.26.3-10ubuntu1 rich set of graph drawing tools".
And anyways, how could missing package break just one or two special poset?
comment:14 Changed 7 years ago by
True. Although I do get this error message:
ERROR Failed to process input Traceback (most recent call last): File "/home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/dot2tex/dot2tex.py", line 2928, in main s = conv.convert(dotdata) File "/home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/dot2tex/dot2tex.py", line 848, in convert return self.output() File "/home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/dot2tex/dot2tex.py", line 2566, in output positions[node.name] = map(int, pos.split(',')) ValueError: invalid literal for int() with base 10: '185.4'
I'm not convinced it is a dot2tex
error. If you run view(P)
it works, but P._hasse_diagram.plot()
does not. I've uncovered another minor issue; the hasse_diagram()
method only returns a DiGraph
, not a HasseDiagram
, but that probably won't fix this problem. The error gets triggered when I create the corresponding DiGraph
object and tell it to plot with layout='acyclic'
.
Also for reference, here's the remaining part of the error message:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-52-ba27df962a36> in <module>() ----> 1 P.hasse_diagram().plot(layout='acyclic') /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/misc/decorators.pyc in wrapper(*args, **kwds) 535 options['__original_opts'] = kwds 536 options.update(kwds) --> 537 return func(*args, **options) 538 539 #Add the options specified by @options to the signature of the wrapped /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in plot(self, **options) 14924 ['black', 'purple', 'yellow', 'yellow'] 14925 """ > 14926 return self.graphplot(**options).plot() 14927 14928 def show(self, **kwds): /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in graphplot(self, **options) 14636 """ 14637 from sage.graphs.graph_plot import GraphPlot > 14638 return GraphPlot(graph=self, options=options) 14639 14640 @options() /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/graph_plot.pyc in __init__(self, graph, options) 236 self._graph = graph 237 self._options = options # contains both plot and show options --> 238 self.set_pos() 239 self._arcs = self._graph.has_multiple_edges(to_undirected=True) 240 self._loops = self._graph.has_loops() /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/graph_plot.pyc in set_pos(self) 306 307 """ --> 308 self._pos = self._graph.layout(**self._options) 309 # make sure the positions are floats (trac #10124) 310 self._pos = dict((k,(float(v[0]), float(v[1]))) for k,v in self._pos.iteritems()) /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in layout(self, layout, pos, dim, save_pos, **options) 14167 14168 if hasattr(self, "layout_%s"%layout): > 14169 pos = getattr(self, "layout_%s"%layout)(dim = dim, **options) 14170 elif layout is not None: 14171 raise ValueError("unknown layout algorithm: %s"%layout) /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/digraph.pyc in layout_acyclic(self, **options) 2937 """ 2938 if have_dot2tex(): -> 2939 return self.layout_graphviz(**options) 2940 else: 2941 return self.layout_acyclic_dummy(**options) /home/travis/sage-5.13.beta2/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in layout_graphviz(self, dim, prog, **options) 14571 positions = dot2tex.dot2tex(self.graphviz_string(**options), format = "positions", prog = prog) 14572 > 14573 return dict( (key_to_vertex[key], pos) for (key, pos) in positions.iteritems() ) 14574 14575 def _layout_bounding_box(self, pos): AttributeError: 'str' object has no attribute 'iteritems'
comment:15 Changed 7 years ago by
- Cc strogdon added
comment:16 Changed 7 years ago by
The ValueError/AttributeError? disappears for me if I include the dot2tex patch which seems to be present in the spkg(s) at ticket #14408. However, perhaps the real issue is that prog='dot'
returns sometimes ints and sometimes floats for the positions. For example, with the patch:
sage: import dot2tex sage: AA = 'digraph {\n "0" [label="0"];\n "1" [label="1"];\n "2" [label="2"];\n "3" [label="3"];\n "4" [label="4"];\n "5" [label="5"];\n "6" [label="6"];\n "7" [label="7"];\n "8" [label="8"];\n "9" [label="9"];\n "10" [label="10"];\n\nedge [color="black"];\n "0" -> "1";\n "0" -> "3";\n "0" -> "6";\n "1" -> "2";\n "1" -> "5";\n "2" -> "7";\n "3" -> "4";\n "3" -> "8";\n "4" -> "5";\n "5" -> "9";\n "6" -> "7";\n "6" -> "8";\n "7" -> "9";\n "8" -> "9";\n}' sage: dot2tex.dot2tex(AA, format="positions", prog="dot") {'0': [113.39, 315.0], '1': [41.39, 241.0], '10': [185.39, 315.0], '2': [41.39, 167.0], '3': [113.39, 241.0], '4': [113.39, 167.0], '5': [113.39, 93.0], '6': [185.39, 241.0], '7': [231.39, 93.0], '8': [185.39, 167.0], '9': [176.39, 19.0]} sage: BB = 'digraph {\n "0" [label="0"];\n "1" [label="1"];\n "2" [label="2"];\n "3" [label="3"];\n "4" [label="4"];\n "5" [label="5"];\n "6" [label="6"];\n "7" [label="7"];\n "8" [label="8"];\n "9" [label="9"];\n "10" [label="10"];\n\nedge [color="black"];\n "0" -> "1";\n "0" -> "3";\n "0" -> "6";\n "1" -> "2";\n "1" -> "5";\n "2" -> "7";\n "3" -> "4";\n "3" -> "8";\n "4" -> "5";\n "5" -> "9";\n "6" -> "7";\n "6" -> "8";\n "7" -> "9";\n}' sage: dot2tex.dot2tex(BB, format="positions", prog="dot") {'0': [137, 315], '1': [209, 241], '10': [209, 315], '2': [247, 167], '3': [65, 241], '4': [27, 167], '5': [128, 93], '6': [137, 241], '7': [200, 93], '8': [99, 167], '9': [164, 19]}
The first example gives a ValueError? without the patch. This can be reproduced from python, so it's not Sage-specific. I suppose what's returned by prog='dot'
should either be always ints or always floats for the positions, but I'm not sure whether the present situation is a bug or a feature, nor is it clear to me which calls in dot2tex produce these values.
comment:17 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:18 Changed 7 years ago by
comment:19 Changed 7 years ago by
- Milestone changed from sage-6.2 to sage-duplicate/invalid/wontfix
- Reviewers set to Travis Scrimshaw
- Status changed from needs_work to positive_review
- Work issues fix dot2tex deleted
I also get that #16026 fixes this.
comment:20 Changed 7 years ago by
- Resolution set to duplicate
- Status changed from positive_review to closed
Another one, gives same error: