Opened 5 years ago
Closed 4 years ago
#24152 closed defect (fixed)
Bug when converting a Sage polyhedron into Polymake pexpect
Reported by: | SimonKing | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.2 |
Component: | interfaces: optional | Keywords: | polymake, IMA-PolyGeom |
Cc: | vdelecroix, mkoeppe, jipilab | Merged in: | |
Authors: | Matthias Koeppe | Reviewers: | Jean-Philippe Labbé |
Report Upstream: | N/A | Work issues: | |
Branch: | a924632 (Commits, GitHub, GitLab) | Commit: | a9246328ef3f80bca645020f871cfc0835fb605c |
Dependencies: | Stopgaps: |
Description (last modified by )
Conversion of a Sage polyhedron into Polymake fails in the first attempt, but succeeds in the second attempt. I've put the example into the first comment rather than in the ticket description.
The fix is to install the File::Slurp module
into perl5. This ticket updates the information about prerequisites (and how to install them) in build/pkg/polymake/SPKG.txt
.
Change History (16)
comment:1 Changed 5 years ago by
comment:2 Changed 5 years ago by
- Cc mkoeppe added
What does self.eval('use File::Slurp;')
mean?
git blame
tells me that the line was introduced by Matthias, so CCing him.
comment:3 follow-up: ↓ 4 Changed 5 years ago by
It's loading a Perl package. http://search.cpan.org/~uri/File-Slurp-9999.19/lib/File/Slurp.pm
We need it for stuff passed by file.
Sage does not control the Perl installation. Should perhaps add a line to the polymake SPKG.txt to alert the user that this package needs to be installed (in addition to a few others that are already listed).
comment:4 in reply to: ↑ 3 Changed 5 years ago by
Replying to mkoeppe:
Sage does not control the Perl installation. Should perhaps add a line to the polymake SPKG.txt to alert the user that this package needs to be installed (in addition to a few others that are already listed).
... and HOW it can be installed. The search "perl install slurp" doesn't give me immediate answer.
comment:5 Changed 5 years ago by
- I did
sudo apt-get install libperl6-slurp-perl
which I think is supposed to install the slurp module on ubuntu. - The example from comment:1 doesn't work after installing slurp: Polymake still cannot find slurp.
- So, we should tell the user how to install slurp AND how to make polymake aware of it.
- All that still doesn't explain why the example fails once and then just works. Apparently the interface can do without slurp, but doesn't.
comment:6 follow-up: ↓ 7 Changed 5 years ago by
Polymake uses Perl5, not 6.
comment:7 in reply to: ↑ 6 Changed 5 years ago by
Replying to mkoeppe:
Polymake uses Perl5, not 6.
Which makes me repeat the question: How to install the slurp module?
$ apt-cache search perl slurp hobbit-plugins - plugins for the Xymon network monitor libdbix-simple-perl - Perl module implementing an simpler interface to DBI libfile-policy-perl - Simple policy for file I/O functions libfile-read-perl - interface for reading one or more files libfile-slurp-perl - single call read & write file routines libfile-slurp-tiny-perl - simple, sane and efficient file slurper libfile-slurp-unicode-perl - Perl module to add Unicode support for the File::Slurp package libfile-slurper-perl - simple, sane and efficient module to slurp a file libperl6-slurp-perl - module implementing the Perl 6 'slurp' built-in libtext-clip-perl - module to clip and extract text in clipboard-like way
Which of the above do I need to install? Hint: It isn't libfile-slurper-perl either.
comment:8 Changed 5 years ago by
sudo apt-get install libfile-read-perl
seems to do the trick. Afterwards, I get
sage: polymake(Polyhedron(eqns = eqns, ieqs=ieqs)) Polytope<Rational>[SAGE271] sage: _.N_INTERIOR_LATTICE_POINTS 952 sage: __.N_LATTICE_POINTS 1260
Anyway.
I find it not good that the polymake interface depends on a specific perl module upon which polymake itself does not depend.
Is it really not possible to provide the same functionality (perhaps slower) if slurp is not installed? If there is a way around slurp then that should be used as a fallback.
And if there is no way around slurp, then the polymake interface should complain about it right in the beginning, giving specific advice on how to install slurp, alerting the user that (s)he has to take care about perl5, not perl6, and so on.
comment:9 Changed 5 years ago by
- Description modified (diff)
comment:10 Changed 5 years ago by
I'd guess (but haven't tested because I am not on Ubuntu) that it would simply be libfile-slurp-perl
. The one that you picked probably installs it as a dependency.
The distribution-independent way of installing Perl packages, of course, is using CPAN.
Specific error handling for failure to load File::Slurp
is a good idea.
One could, of course, provide a simplified version of read_file
directly, instead of requiring File::Slurp
. But I don't think it's worth it.
comment:11 Changed 4 years ago by
- Branch set to u/mkoeppe/bug_when_converting_a_sage_polyhedron_into_polymake_pexpect
comment:12 Changed 4 years ago by
- Cc jipilab added
- Commit set to a9246328ef3f80bca645020f871cfc0835fb605c
- Description modified (diff)
- Milestone changed from sage-8.1 to sage-8.2
- Status changed from new to needs_review
New commits:
a924632 | polymake SPKG.txt: Mention File::Slurp and CPAN
|
comment:13 Changed 4 years ago by
Needs review and fixes the problem reported by jipilab on #24905.
comment:14 Changed 4 years ago by
- Reviewers set to Jean-Philippe Labbé
- Status changed from needs_review to positive_review
This solved the problem raised in #24905 and the above failing example works as well on my computer. This looks good to go.
comment:15 Changed 4 years ago by
- Keywords IMA-PolyGeom added
comment:16 Changed 4 years ago by
- Branch changed from u/mkoeppe/bug_when_converting_a_sage_polyhedron_into_polymake_pexpect to a9246328ef3f80bca645020f871cfc0835fb605c
- Resolution set to fixed
- Status changed from positive_review to closed
Note that a user reported that the above point count is incorrect in Sage, that's why I tested what polymake has to say (and find that it agrees with Sage).
So, the bug is that the first attempt of converting P fails, while the second attempt succeeds.