sagemathinc / cocalc

CoCalc: Collaborative Calculation in the Cloud
https://CoCalc.com
Other
1.17k stars 216 forks source link

software request: numericalsgps gap package #2333

Open williamstein opened 7 years ago

williamstein commented 7 years ago

Requested by: Christopher ONeill

Is it possible to install a GAP package within Sage on the CoCalc server? I frequently
 use the "numericalsgps" GAP package within Sage for undergraduate research
 projects, and it would be great if they could run the their computations through
 CoCalc without having to install Sage locally. I have included a link to the 
package below.

https://www.gap-system.org/Packages/numericalsgps.html

Please let me know if there is any additional information I can provide.
DrXyzzy commented 7 years ago

Looks as if admin is needed for sage -i, and gap packages go into $SAGE_ROOT/local/gap/latest/pkg:

~$ sage -sh -c 'echo $SAGE_ROOT/local/gap/latest/pkg'
/ext/sage/sage-8.0/local/gap/latest/pkg

@haraldschilly, is this something you should do?

williamstein commented 7 years ago

@DrXyzzy yes, @hsy does all of this right now. That said, I typed a search in Google and got the first hit http://www.math.rwth-aachen.de/~Greg.Gamble/gap4r3/doc/htm/ref/CHAP074.htm, which says

" therefore it is easy to install a package locally even if a user has no permission to add files to the main GAP installation. Thus, GAP packages also provide an easy way to add optional components to the functionality of GAP."

haraldschilly commented 7 years ago

yes, I'll do this, I'll write updates here

haraldschilly commented 7 years ago

I've looked into this. I'm asking at the sage project to add this package to sage's gap_packages and then it is installed by default. William's comment above is correct and confirming via:

sage -gap
[...]
gap> GAP_ROOT_PATHS;
[ "/home/user/.gap/", "/ext/sage/sage-8.0/local/gap/latest/" ]

Reveals that you can install your own packages in your ~/.gap directory.

dimpase commented 7 years ago

GAP packages which use so-called GAP kernel extensions are presently impossible to use within Sage, as they break libGAP. See e.g. https://trac.sagemath.org/ticket/20673 for details.

On the other hand, packages which are just GAP code (and, naturally, do not depend upon the packages as above) can be installed in user's own ~/.gap directory. And numericalsgps is of this type.

Packages that also include nontrivial executables to be built might be a bit harder, YMMV due to the need for a dev. toolchain.

PS. I'm trying to push this upstream: https://github.com/gap-system/gap/issues/1499

williamstein commented 7 years ago

We could have a system-wide GAP with such packages... to even more confuse users and complicate things.

slel commented 7 years ago

I don't think it would create confusion or complicate things.

The installation process for GAP is now very straightforward. Alex Konovalov and I sat together for a few hours last January at the OpenDreamKit meeting at ICMS in Edinburgh, and managed to install GAP and most of its packages in a CoCalc project.

I think a complete GAP install on CoCalc would make sense:

Only Sage's GAP would remain what it is, until that improves too.

Complication will decrease again once GAP 4.9 is out and Sage trac ticket #22626 is dealt with. At that point Sage will be able to use a system GAP, and it will be easy to install as many GAP packages as one wants, and use them from Sage, if I understand correctly.

haraldschilly commented 7 years ago

Oh, using an up-to-date system-gap sounds very good.

And small note for those who are interested. There is already the system-wide gap provided by ubuntu. It's behind the one in Sage and you can run it from /usr/bin/gap

The reason why you don't get it by just typing in "gap" is the small wrapper script /ext/bin/gap starting the one inside sage for you. I had no idea there are such specific adaptations to gap to be able to run it in Sage.

Anyways, let's wait until #22626 is in.

dimpase commented 7 years ago

System-wide ubuntu GAP does not have all the available packages. So that's a non-starter in this sense.

slel commented 6 years ago

Arguably an up-to-date system-wide GAP installation is the object of #791. I suggest installing GAP 4.8.9 rather than waiting for GAP 4.9 -- see #791.

slel commented 6 years ago

Solved by the recent installation of GAP 4.9.1 system-wide on CoCalc.

Open a CoCalc terminal, then launch GAP and load NumericalSgps as follows:

~$ gap
 ┌───────┐   GAP 4.9.1 of 05-May-2018
 │  GAP  │   https://www.gap-system.org
 └───────┘   Architecture: x86_64-pc-linux-gnu-default64
 Configuration:  gmp 6.1.0, readline
 Loading the library and packages ...
 Packages:   AClib 1.3, Alnuth 3.1.0, AtlasRep 1.5.1, AutPGrp 1.9, Browse 1.8.7, Carat 2.2.2, CRISP 1.4.4, Cryst 4.1.17,
             CrystCat 1.1.8, CTblLib 1.2.2, FactInt 1.6.2, FGA 1.4.0, GAPDoc 1.6.1, IO 4.5.1, IRREDSOL 1.4, LAGUNA 3.9.0,
             Polenta 1.3.8, Polycyclic 2.13.1, PrimGrp 3.3.1, RadiRoot 2.8, ResClasses 4.7.1, SmallGrp 1.3, Sophus 1.24,
             SpinSym 1.5, TomLib 1.2.6, TransGrp 2.0.2, utils 0.54
 Try '??help' for help. See also '?copyright', '?cite' and '?authors'
gap> LoadPackage( "numericalsgps" );
#I  Please load package NormalizInterface or 4ti2Interface
#I  to have extended functionalities.
#I  Please load package SingularInterface or singular (not both)
#I  or GradedModules to have extended functionalities.
----------------------------------------------------------------
Loading  NumericalSgps 1.1.7
For help, type: ?NumericalSgps:
----------------------------------------------------------------
true
gap>  
coneill-math commented 6 years ago

It appears the numericalsgps package is only available via the GAP terminal, and not from within Sage notebooks. In particular, running gap('LoadPackage("numericalsgps");') from within Sage fails. Does something extra need to be done when creating the Sage notebook in order to access additional GAP packages?

dimpase commented 6 years ago

This package only contains GAP code, and thus it may be installed in the home directory of the project and then loaded via gap.load_package() -- this is equivalent to the command above,but a bit less verbose -- or libgap.LoadPackage() - depending upon the interface you want to interact with GAP.

dimpase commented 6 years ago

In more detail, open the terminal and run

wget https://github.com/gap-packages/numericalsgps/releases/download/v1.1.8/NumericalSgps-1.1.8.tar.gz
mkdir .gap
mkdir .gap/pkg
cd .gap/pkg/
tar xf ~/NumericalSgps-1.1.8.tar.gz

after this, you should be able to load this package in a new session.

HTH, if not, please ask for a clarification.

slel commented 5 years ago

GAP 4.10.2, now installed on the CoCalc instance at cocalc.com, includes the PackageManager GAP package.

This makes it very easy for users to install packages.

In a CoCalc project with internet access:

$ gap
gap> LoadPackage("PackageManager");
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loading  PackageManager 0.4 (Easily download and install GAP packages)
by Michael Torpey (http://www-groups.mcs.st-andrews.ac.uk/~mct25/).
Homepage: https://gap-packages.github.io/PackageManager/
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
true
gap> InstallPackage("https://gap-packages.github.io/numericalsgps/PackageInfo.g");
#I  Retrieving PackageInfo.g from https://gap-packages.github.io/numericalsgps/PackageInfo.g ...
#I  PackageInfo.g validated successfully
#I  Downloading archive from URL https://github.com/gap-packages/numericalsgps/releases/download/v1.2.0/NumericalSgps-1.2.0.tar.gz ...
#I  Saved archive to /tmp/tm63KZ64/NumericalSgps-1.2.0.tar.gz
#I  Extracting to /home/user/.gap/pkg/NumericalSgps-1.2.0 ...
#I  Extracted successfully
#I  Checking dependencies for NumericalSgps...
#I  Running compilation script on /home/user/.gap/pkg/NumericalSgps-1.2.0 ...
#I  Compilation was successful
true
gap> 
haraldschilly commented 5 years ago

no, GAP 4.10.2 is not installed right now. you must be running your project with the "experimental" software environment. this will be available some day in the future, though.

slel commented 5 years ago

Right, thanks for clarifying... and for immediately improving the situation by making it so that gap now launches GAP 4.10.2 not only in the "experimental" software environment but also in the "default" one.

Reference: