"Offline" Installation Packages via Proxy

Hello, everyone

I am new to julia. Is it possible, to use julia (v1.7.3) offline and also take the advantages from the package management? I am able to get some stuff from github by an other url (mirror-server/proxy), but i can’t reach either github.com or pkg.julialang.org directly.
In this case, i want to get https://github.com/quinnj/MusicAlbums.jl and resolve the deps in the project.toml.

(Sorry for strange links, but i got an error “new users can only put 2 links in a post.”)

PROXYURL replaces the long URL of the proxy/mirrorserver.

(@v1.7) pkg> dev https://PROXYURL/quinnj/MusicAlbums.jl
  Installing known registries into `~/.julia`
┌ Warning: could not download https://pkg.julialang.org/registries
│   exception = Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/Registry/Registry.jl:82
┌ Warning: could not download https://pkg.julialang.org/registries
│   exception = Could not resolve host: pkg.julialang.org while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/Registry/Registry.jl:82
     Cloning registry from "https://github.com/JuliaRegistries/General.git"
ERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:Net, failed to resolve address for github.com: Name or service not known)

This doesnt also work for me:

(@v1.7) pkg> registry add https://PROXYURL/JuliaRegistries/General
     Cloning registry from "https://PROXYURL/JuliaRegistries/General"
ERROR: failed to clone from https://PROXYURL/JuliaRegistries/General, error: GitError(Code:ERROR, Class:HTTP, unexpected http status code: 404

)

The connection from the os cli (ubuntu 20.04) looks fine:

coffee@server:~$ curl -XGET https://PROXYURL/JuliaRegistries/General
[ {
  "name" : "KristofferC-patch-1",
  "commitId" : "774d78ebe8bd699bc96396531064a3253370e03b",
  "isBranch" : true
}, {
  "name" : "kc/consistent_spacing",
  "commitId" : "035140a7c8b5e6b2a19043c73f925204a408f19c",
  "isBranch" : true
}, {
  "name" : "kc/statistics_compat",
  "commitId" : "72ee85d3ece15d1d562938c70d2ab98d3a95d411",
  "isBranch" : true
[....]

I’m searching for a comfortable way, not the “transfer via usb-stick” way :slight_smile:
So far I’ve only found “copy solutions”.

Do you have any ideas?

1 Like

I believe GitHub - GunnarFarneback/LocalRegistry.jl: Create and maintain local registries for Julia packages.

is for that exactly, but I’ve not looked much into it. Because this is a problem I, and think most users, don’t have (unless in China, or behind company firewall, can also suggest opening it), so maybe not well known. Maybe it should be documented in Julia’s docs, if it isn’t already. I suggest you make a doc PR… except I see github.com is blocked for you. :slight_smile:

Yes, though I suggest the supported 1.8.2 (both have same limitations in this regard). Julia itself doesn’t have a problem with offline (or e.g. compiled to binaries), just Pkg of it (e.g. in REPL). One other workaround might be to copy .julia folder with installed packages from some other computer that did have access. This would usually work, though if Julia compiles packages to native code already (I think it does), it might be a problem if the other computer is newer (or e.g. different arch, say ARM).

I tried your suggestion, but it also fails: ERROR: failed to clone from https://github.com/JuliaRegistries/General.git

You are right, it’s a company Firewall :wink:
Github ist only blocked when I access it via https://github.com/Julia..... Instead I have to use https://PROXYURL/ANOTHERSTUFF/Julia...., which works fine (see curl in first post). I thought, that i can add my own registry or change the default-github-URL by edit files like ./julia-1.7.3/share/julia/stdlib/v1.7/Pkg/src/Registry/Registry.jl and replace the string. But somehow nothing works for me.

Copying the .julia directory here is a bigger hassle that I wanted to avoid.
If no one else has an idea, I guess that’s the only option.

I wonder about these somehow strange proxy setting. Are you sure, that the typically settting of environment variables http_proxy, https_proxy, … doesn’t work?
Because with the need to change the URL every application which does something on the network would fail. Not that this isn’t very common these days.

Do you need any help about setting http_proxy, https_proxy?