Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error" when loading Oscar without internet connection #1364

Closed
joschmitt opened this issue Jun 1, 2022 · 3 comments
Closed

"Error" when loading Oscar without internet connection #1364

joschmitt opened this issue Jun 1, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@joschmitt
Copy link
Member

Describe the bug
Whenever I do using Oscar without internet connection, I get an error from GAP:

ERROR: InitError: Error thrown by GAP: Error, Could not resolve host: raw.githubusercontent.com while requesting https://raw.githubusercontent.com/gap-system/gap-distribution/master/DistributionUpdate/PackageUpdate/currentPackageInfoURLList in
  Julia.Core._apply( julia_obj, args ) at /home/johannes/.julia/packages/GAP/3l2vi/pkg/JuliaInterface/gap/calls.gi:15 called from 
PKGMAN_DownloadURL( PKGMAN_PackageInfoURLList ) at /home/johannes/.julia/packages/GAP/3l2vi/gaproot/v1.7/pkg/PackageManager-1.1/gap/PackageManager.gi:10 called from
GetPackageURLs(  ) at /home/johannes/.julia/packages/GAP/3l2vi/gaproot/v1.7/pkg/PackageManager-1.1/gap/PackageManager.gi:78 called from
InstallPackageFromName( string, interactive ) at /home/johannes/.julia/packages/GAP/3l2vi/gaproot/v1.7/pkg/PackageManager-1.1/gap/PackageManager.gi:61 called from
<function "InstallPackage">( <arguments> )
 called from read-eval loop at *defin*:0

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] ThrowObserver(depth::Int32)
    @ GAP ~/.julia/packages/GAP/3l2vi/src/GAP.jl:68
  [3] _call_gap_func(func::GAP_jll.GapObj, a1::GAP_jll.GapObj, a2::Bool)
    @ GAP ~/.julia/packages/GAP/3l2vi/src/ccalls.jl:270
  [4] call_gap_func_nokw
    @ ~/.julia/packages/GAP/3l2vi/src/ccalls.jl:224 [inlined]
  [5] (::GAP_jll.GapObj)(a1::GAP_jll.GapObj, a2::Bool)
    @ GAP ~/.julia/packages/GAP/3l2vi/src/ccalls.jl:235
  [6] install(spec::String; interactive::Bool, quiet::Bool, pkgdir::String)
    @ GAP.Packages ~/.julia/packages/GAP/3l2vi/src/packages.jl:87
  [7] load(spec::String, version::String; install::Bool, quiet::Bool)
    @ GAP.Packages ~/.julia/packages/GAP/3l2vi/src/packages.jl:48
  [8] __init__()
    @ Oscar ~/.julia/dev/Oscar/src/Oscar.jl:166
  [9] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
 [10] _require_from_serialized(path::String)
    @ Base ./loading.jl:821
 [11] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1130
 [12] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
 [13] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
during initialization of module Oscar

Then I have to do using Oscar again to be able to use Oscar.

To Reproduce
Turn of internet (or get on a train 😄) and do using Oscar.

Expected behavior
Oscar loads without error.

System (please complete the following information):

julia> Oscar.versioninfo(full = true)
OSCAR version 0.9.0 - #master, 6fbae687c -- 2022-05-31 15:37:15 +0200
  combining:
    AbstractAlgebra.jl   v0.26.0
    GAP.jl               v0.8.0
    Hecke.jl             v0.14.2
    Nemo.jl              v0.31.0
    Polymake.jl          v0.7.2
    Singular.jl          v0.10.2
  building on:
    Antic_jll               v0.200.501+0
    Arb_jll                 v200.2200.0+0
    Calcium_jll             v0.400.102+0
    FLINT_jll               v200.800.500+0
    GAP_jll                 v400.1192.2+1
    Singular_jll            v403.1.300+0
    libpolymake_julia_jll   v0.8.0+2
    libsingular_julia_jll   v0.23.1+0
    msolve_jll              v0.2.3+1
    polymake_jll            v400.600.0+0
See `]st -m` for a full list of dependencies.

Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, tigerlake)
Environment:
  JULIA_EDITOR = vim
Official https://julialang.org/ release
@joschmitt joschmitt added the bug Something isn't working label Jun 1, 2022
@ThomasBreuer
Copy link
Member

The critical code line is probably GAP.Packages.load("browse"; install=true) in the __init__ function in src/Oscar.jl.
Another instance of this problem is the attempt to install GAP's ferret package, in the __init__ function in experimental/GaloisGrp/GaloisGrp.jl.

The idea is to install the GAP package in question if necessary and then to load it. If the package is already installed then the error should disappear, perhaps this is the reason why this problem was not observed earlier.

I would argue that such installations should not be expected at runtime, because one may be offline.
In the two current cases, Oscar works also if the packages are not available, but the performance is better if they are.
Thus it would suffice if the the attempt to install the package is skipped in offline mode.
It would be better to find a place to handle such "dependencies" already at the time when Oscar gets installed.

@fingolfin
Copy link
Member

fingolfin commented Jun 3, 2022

We will take care of it.

ThomasBreuer added a commit to ThomasBreuer/PackageManager that referenced this issue Jun 13, 2022
Most of the `Error` (actually `ErrorNoReturn`) calls in the code
of PackageManager belong to argument checks.
These are fine from the viewpoint of programmatic access to
PackageManager's functions.

The only exceptions are two places in `GetPackageURLs`,
which are reached if either `PKGMAN_DownloadURL` fails
or the downloaded file is corrupted.
These error are problematic for example when Julia code wants to use
PackageManager to install GAP packages at runtime,
see oscar-system/Oscar.jl/issues/1364.

The proposed changes replace the `ErrorNoReturn` calls
by returning the result record with a new component `success`
that is set to `false`.
In the three situations where `GetPackageURLs` is called,
this component gets evaluated.

As far as I see, the documentation need not be changed.
First of all, the function `GetPackageURLs` is undocumented.
The three functions that call it (`InstallPackageFromName`,
`PKGMAN_InstallDependencies`, `UpdatePackage`) do anyhow return
results that indicate failures, and they do not promise error messages
if one is offline.

In order to inform the user about the reason for the failures,
now info messages are printed by `GetPackageURLs`

(Would there be any way to *test* the offline behaviour of PackageManager?)
@fingolfin
Copy link
Member

Should be fixed now with the latest GAP.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants