sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.37k stars 466 forks source link

Non-functioning dot2tex breaks poset creation in an unclear way #18124

Closed novoselt closed 9 years ago

novoselt commented 9 years ago

On a system with optional package dot2tex installed, but no GraphViz:

sage: P = posets.PentagonPoset()
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

To exit: use 'exit', 'quit', or Ctrl-D.

I believe the problem is coming from this:

sage: from sage.graphs.dot2tex_utils import have_dot2tex
sage: have_dot2tex()
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

To exit: use 'exit', 'quit', or Ctrl-D.

which is obviously wrong and extremely confusing to users - surely poset creation is independent of TeX!

CC: @sagetrac-sage-combinat @anneschilling @nthiery @nathanncohen @nexttime @bsalisbury1 @tscrim

Component: combinatorics

Author: Jeroen Demeyer

Branch/Commit: 946f67d

Reviewer: Nathann Cohen

Issue created by migration from https://trac.sagemath.org/ticket/18124

novoselt commented 9 years ago
comment:1

And it looks like the optional package dot2tex IS installed, but there is no dot2tex itself.

novoselt commented 9 years ago
comment:2

Looking further, I assume dot2tex package actually installs dot2tex and it is just not present on the system. I am confused by versions:

sc_serv@sctest:~$ sage/sage -i|grep dot2tex
dot2tex-20120520
sc_serv@sctest:~$ sage/sage -sh -c "dot2tex --version"
Dot2tex version 2.9.0dev

while http://sagemath.org/packages/optional/ lists dot2tex-2.8.7.p2.spkg

The system in question is SageMathCell: http://sagecell.sagemath.org/?z=eJxTVS3O4OUqTkxPVdDNrEkvSi1QSMkvMSpJreDlgjIUdHXLUouKM_PzAEdZDwg=&lang=sage

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 9 years ago
comment:3

Replying to @novoselt:

Looking further, I assume dot2tex package actually installs dot2tex and it is just not present on the system. I am confused by versions:

sc_serv@sctest:~$ sage/sage -i|grep dot2tex
dot2tex-20120520
sc_serv@sctest:~$ sage/sage -sh -c "dot2tex --version"
Dot2tex version 2.9.0dev

while http://sagemath.org/packages/optional/ lists dot2tex-2.8.7.p2.spkg

That's "new-style spkg" weirdness:

The old one (2.8.7.p2) is a real spkg, and listed on .../packages/optional/.

The new one (2.9.0dev) has its package metadata only shipped with newer versions of Sage (part of the "unified" git tree, such that you cannot install it on older Sage versions); its corresponding upstream tarball is available as http://sagemath.org/packages/upstream/dot2tex/dot2tex-20120520.tar.bz2.


Did you try to reinstall it with sage -f dot2tex? (Note that at least GraphViz is a prerequisite of it.)

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 9 years ago
comment:4

Replying to @nexttime:

Did you try to reinstall it with sage -f dot2tex? (Note that at least GraphViz is a prerequisite of it.)

... which means you should better try sage -f -c dot2tex.

tscrim commented 9 years ago
comment:5

You might be interested in #17171.

novoselt commented 9 years ago
comment:6

Replying to @nexttime:

... which means you should better try sage -f -c dot2tex.

Tons of errors, GraphViz is not installed. The issue, however, is that I am not trying to make any pictures! Changes that I think have to be done (either one will suffice, but both are better):

  1. Check that things work properly, i.e. don't crash if they don't work.
  2. Check that prerequisites are installed during installation of dot2tex and fail if they are not available.

I does not look like #17171 addresses the first point, not sure about the second one.

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 9 years ago
comment:7

Replying to @novoselt:

Replying to @nexttime:

... which means you should better try sage -f -c dot2tex.

Tons of errors, GraphViz is not installed.

Yes. I could reproduce the errors you reported on a previously TeX-free system, but only after installing dot2tex (without -c, otherwise the installation would have failed).

Installing GraphViz alone didn't help; after installing a couple of additional (La)TeX-related packages the errors in Sage finally vanished, while the number of failures in dot2tex's test suite only decreased.

The issue, however, is that I am not trying to make any pictures!

Yep, that's odd, although you must have installed dot2tex at some point... ;-) (So the ticket's title is somewhat misleading.)

Changes that I think have to be done (either one will suffice, but both are better):

  1. Check that things work properly, i.e. don't crash if they don't work.

Agreed, a non-working dot2tex installation shouldn't affect rather unrelated things, especially since you cannot (easily) uninstall dot2tex.

  1. Check that prerequisites are installed during installation of dot2tex and fail if they are not available.

Yep, some minimal prerequisite check should probably be performed in its spkg-install. (Test suite failures don't necessarily mean dot2tex would be completely unusable, and we normally don't want to run a test suite unless the user explicitly asked for doing so.)

I does not look like #17171 addresses the first point, not sure about the second one.

Well, not yet, still needs review...

83660e46-0051-498b-a8c1-f7a7bd232b5a commented 9 years ago
comment:8

Replying to @nexttime:

Installing GraphViz alone didn't help; after installing a couple of additional (La)TeX-related packages the errors in Sage finally vanished, while the number of failures in dot2tex's test suite only decreased.

P.S.: From dot2tex's SPKG.txt:

== Dependencies ==

graphviz (www.graphviz.org) should be installed and in the path (for
example via the graphviz spkg).

preview, a LaTeX package for extracting parts of a document.

Necessary, but presumably not sufficient (at least to make 2.9.0dev's test suite pass), but perhaps the packages I installed are also too old.

novoselt commented 9 years ago
comment:9

Agreed about the title - my understanding of the issue improved as I was writing the description ;-)

Listing dependencies is not enough - the point of packaging systems is to take care of them automatically. I've installed dot2tex because it is installed in the cloud and in general the goal is to provide as many useful packages as possible through SageMathCell. So I will install GraphViz on the next update, but the issues here still have to be fixed: the code in have_dot2tex obviously tries to catch all exceptions, but it is not sufficient.

novoselt commented 9 years ago

Description changed:

--- 
+++ 
@@ -1,4 +1,4 @@
-On a system without dot2tex installed:
+On a system with optional package dot2tex installed, but no GraphViz:

sage: P = posets.PentagonPoset()

jdemeyer commented 9 years ago

Branch: u/jdemeyer/non_functioning_dot2tex_breaks_poset_creation_in_an_unclear_way

jdemeyer commented 9 years ago

Commit: db39f4d

jdemeyer commented 9 years ago

New commits:

db39f4dFix dot2tex tests by checking for SystemExit also
jdemeyer commented 9 years ago

Author: Jeroen Demeyer

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 9 years ago

Reviewer: Nathann Cohen

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

946f67dAdd one more "optional graphviz"
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from db39f4d to 946f67d

vbraun commented 9 years ago

Changed branch from u/jdemeyer/non_functioning_dot2tex_breaks_poset_creation_in_an_unclear_way to 946f67d