Determining version

Questions and problems about using polymake go here.

Moderator: Moderators

maclagan
Posts: 3
Joined: 04 Apr 2019, 21:25

Determining version

Postby maclagan » 04 Apr 2019, 21:52

Hi,

What's the best way to determine the version of polymake that is installed automatically?

Context: I'm writing a Macaulay2 package that will use some polymake functionality if the user has polymake installed, and do things differently if not. For this we need to know whether the user has polymake version >3.0 installed, and the method should not depend on how they have it installed.

One of my coauthors, working under linux, has suggested string searching on "polymake --version". However, at least on my Mac, that just launches a new terminal starting polymake (and doesn't return a string). Is there another method?

We'd prefer to not need to know whether the user has polymake installed, if they have it.

Thanks,
Diane

User avatar
gawrilow
Main Author
Posts: 331
Joined: 25 Dec 2010, 17:40

Re: Determining version

Postby gawrilow » 04 Apr 2019, 23:29

Code: Select all

polymake-config --version
should help.

Actually, polymake 3.0 is quite an ancient version, do you really want to spend time on supporting it in a special way?
We'd prefer to not need to know whether the user has polymake installed, if they have it.
Is this a feature request to the polymake team or an abstract lament? How could we help you here?

maclagan
Posts: 3
Joined: 04 Apr 2019, 21:25

Re: Determining version

Postby maclagan » 05 Apr 2019, 01:34

Hi,

I don't understand this answer - is polymake-config assuming that we have the source code somewhere (and know where that is)?

If I know nothing about the user's polymake installation, is there no way to get the version? Or am I missing something?

Thanks,
Diane
Last edited by maclagan on 05 Apr 2019, 09:44, edited 1 time in total.
Reason: erroneously managed to enter an answer under another user's name

User avatar
joswig
Main Author
Posts: 215
Joined: 24 Dec 2010, 11:10

Re: Determining version

Postby joswig » 05 Apr 2019, 09:45

As Ewgenij had pointed out, calling

Code: Select all

> polymake-config --version 3.3
from the terminal shell is the standard way to learn about the polymake version. The executable polymake-config is installed alongside the actual polymake. There are also many other things that you can figure out about the installation via polymake-config.

If, for whatever reason, you do not want to call polymake-config, then you can also do

Code: Select all

> polymake --version polymake version 3.3, branch master [11 behind origin/master] Copyright (c) 1997-2019 Ewgenij Gawrilow, Michael Joswig (TU Berlin) https://polymake.org This is free software licensed under GPL; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. instead. It will then produce the greeter (as always). But it will exit right after that.
If you want to know the version while you are running polymake, then

Code: Select all

polytope > print $Version; 3.3
may help.

Does this answer your question? Andreas, our Mac expert will say something, too.

paffenholz
Developer
Posts: 175
Joined: 24 Dec 2010, 13:47

Re: Determining version

Postby paffenholz » 05 Apr 2019, 09:55

At least its installation directory needs to be in the $PATH, as polymake can be installed anywhere, and searching the path is the only standard way to detect installed software. If it is, calling

Code: Select all

polymake --version
or

Code: Select all

polymake-config --version
should work. You can also check for some standard installation locations, which would be

Code: Select all

/usr/local/bin
for linux and Mac OS installs, and

Code: Select all

/Applications/polymake.app/Contents/Resources/polymake/bin/
on a Mac if the precompiled bundle was used (here you can only call polymake-config, polymake itself is installed differently in the bundle).

From your description on what happens on your Mac I assume that you have installed the bundle, and then added something like

Code: Select all

alias polymake="open -a polymake --args"
to your .bashrc. This cannot be autodetected and breaks the option to just call polymake in the shell to determine the version. It is safer to use polymake-config for this, as it is unlikely to be aliased to something else. Also, on a Mac with bundle at the standard location you could do

Code: Select all

/Applications/polymake.app/Contents/MacOS/polymake.start --version
to determine the version.

In general, you should probably give users the opportunity to specify an installation location via some configuration option for the case that polymake is not installed at a standard location.

User avatar
gawrilow
Main Author
Posts: 331
Joined: 25 Dec 2010, 17:40

Re: Determining version

Postby gawrilow » 05 Apr 2019, 09:56

is polymake-config assuming that we have the source code somewhere (and know where that is)?
No, having the source code is not necessary. polymake-config is a small script installed together with the rest of polymake, so it's contained in the Debian/Ubuntu packages, Mac disc images, etc. It resides in the same folder as the main script "polymake".

maclagan
Posts: 3
Joined: 04 Apr 2019, 21:25

Re: Determining version

Postby maclagan » 07 Apr 2019, 04:29

I found polymake-config, but get the following error:

Code: Select all

./polymake-config --version Global symbol "$InstallArch" requires explicit package name at ./polymake-config line 21. Global symbol "$InstallArch" requires explicit package name at ./polymake-config line 44. Global symbol "$InstallArch" requires explicit package name at ./polymake-config line 45. Global symbol "$InstallArch" requires explicit package name at ./polymake-config line 45. Global symbol "$InstallArch" requires explicit package name at ./polymake-config line 53. BEGIN not safe after errors--compilation aborted at ./polymake-config line 172.
This is a version of 3.0 installed with the Mac bundle - my previous problem was that this directory is not on my path, as with the bundle it's polymake.app/Contents/MacOS/ that needed to be on the path (at least that's what I had assumed!). I'll update to the more recent version, but this suggests to me that we should be making our users tell us whether polymake is installed, rather than auto-detecting it (since we won't know what they've done with their paths...).

Diane

paffenholz
Developer
Posts: 175
Joined: 24 Dec 2010, 13:47

Re: Determining version

Postby paffenholz » 07 Apr 2019, 12:53

The error with polymake-config is fixed in more recent versions of the polymake bundle. This script also tells you the required compiler and linker flags if you want to link against libpolymake.

polymake in the bundle needs some environment variables to be set, so instead of the actual polymake script there is a small wrapper script with the same name in the MacOS folder which sets these variables and then calls polymake in Resources/polymake/bin/.

If you want to start polymake inside an existing terminal window you should call polymake.start in the MacOS folder or set an alias to this script. This script passes all given comand line options (like --version) to polymake.

Andreas


Return to “Helpdesk”

cron