JuliaLang / juliaup

Julia installer and version multiplexer
MIT License
1.02k stars 86 forks source link

Add juliaup as an Ubuntu "snap"? #349

Open PallHaraldsson opened 2 years ago

PallHaraldsson commented 2 years ago

Hi,

I see only a "prerelease version" is available on Linux Now considered "considered production ready" not just on Windows.

I did NOT manage to use juliaup on Ubuntu 22.04 LTS the first time around (i.e. with the "snap" curl, but then but then with curl from apt...).

A) I can see that you would be wary of supporting juliaup as a snap, given the problem below (which I managed to fix; I keeping the (mostly) outdated) info in C) to show potential problem). With supporting juliaup as a snap, at least you would avoid the curl issue.

B)

"Julia will look for a new version of Juliaup itself every 1440 seconds when you start julia."

That's intriguing, and a nice touch. It seems to have (only) 177.6-175.4 = 2.2 ms. (1.3%) overhead over:

$ hyperfine '/home/ubuntu/.julia/juliaup/julia-1.7.3+0.x64/bin/julia -e ""'
Benchmark 1: /home/ubuntu/.julia/juliaup/julia-1.7.3+0.x64/bin/julia -e ""
  Time (mean ± σ):     199.6 ms ±  19.3 ms    [User: 177.8 ms, System: 99.8 ms]
  Range (min … max):   175.4 ms … 225.7 ms    13 runs

despite the large 3986584-byte size of julialauncher (so I'm not too concerned with improving the overhead/reducing the file-size, until startup of Julia itself if better... comparable to perl or Python). Since I'm rather obsessed with timing, and the the Julia startup, I will keep in mind bypassing the julialauncher. You might want to document it for benchmarkers (if not done already), how; when it actually looks for an update the overhead is larger, does it print out something to show that it's checking? That would help, but still hidden by hyperfine...

C) Note, I'm running from an Ubuntu from a USB stick, and thought it might be a simple permission (or capacity) problem for /tmp, but seem to have ruled that out.

When/if Ubuntu is supported, would you be open to have juliaup as the default "snap" for julia (and/or juliaup)?

Right now you get:

ubuntu@ubuntu:~$ julia
Command 'julia' not found, but can be installed with:
sudo snap install julia

so newbies are likely to do that, and now even on rather new 22.04 you get Julia 1.0.4, not even the latest (then supported) 1.0.5, which is of course bad, and while maybe useful to some, or as a first step, it's bad since it's a 32-bit version (even on 64-bit), and thus you get cryptic error when using with PyCall (i.e. for interopting with 64-bit Python or I guess other 64-bit code).

I like to get rid of julia as a snap, not even replacing with Julia 1.6 LTS, for many reasons, it only gets one julia version, and Julia is a moving target, and I do not trust snap that much (others have written against it, could dig it up; in Linux Mint community if I recall).

So could juliaup be a drop-in replacement? Note for Julia you need to add "--classic" because of "classic confinement", and I'm not sure if that's a problem for juliaup. I think without that (or at least with) juliaup could work, and even though juliaup would be a snap, it would download regular non-snap julia, as we would want.

Since I've not tried it I'm not sure, but the installation procedure would for sure install juliaup, and I'm not sure if be default (but would be helpful to all, not just snap users, where kind of a requirement), install a default julia (latest non-LTS?).

I did try straight up ./juliaup.sh (and also this way, same error, except for prefix):

$ bash --debugger juliaup.sh 
juliaup.sh: /usr/share/bashdb/bashdb-main.inc: No such file or directory
juliaup.sh: warning: cannot start debugger; debugging mode disabled

info: downloading installer
curl: (23) Failure writing output to destination
juliaup: command failed: downloader https://julialang-s3.julialang.org/juliaup/bin/juliainstaller-1.6.12-x86_64-unknown-linux-gnu /tmp/tmp.dDqzCuc4wU/juliainstaller x86_64-unknown-linux-gnu

That's rather strange as it made the dir, but not the file, and I could do that with touch, and edit the file:

$ touch /tmp/tmp.7GVYWDjIYM/juliainstaller

Note, curl was not installed, and I could do "snap install curl" without sudo, that was suggested... (with apt, where sudo was also suggested (and would get older curl), it was really required). I don't think it was a self-made mess because I (intentionally) skipped sudo, at least uninstalling and then installing with sudo snap install didn't help. I'm also thinking of some users that do not have sudo rights (and curl installed, likely rare to have neither).

https://askubuntu.com/questions/1387141/curl-23-failure-writing-output-to-destination

After a very long research I found a useful hint.

Can't write to a hidden path using Curl

Basically snap curl is useless. Uninstall it properly. Get the proper apt curl, and everything works like a charm.

One way would be to recommend using wget (rather than curl), that's actually installed in Ubuntu, or change your README to recommend apt for getting curl if it's not installed and/or explain the error "curl: (23) Failure writing output to destination" pointing to the URL above.

davidanthoff commented 2 years ago

Yes, in an ideal world Juliaup would eventually be what you get if you type either sudo apt install julia or sudo snap install julia. Having said that, there are a few more things I need to add here before we can start to initiate the process (primarily add a way that the version DB can be updated independently of the Juliaup binaries), so for now I would say we just don't do anything on this front.

petvana commented 1 year ago

Is there any chance juliaup would be registered as a package for Ubuntu 24.04?

davidanthoff commented 1 year ago

My long-term hope is that we can get this machinery here into Ubuntu/Debian as sudo apt install julia. But I think before we can even attempt that we need to officially switch this to be the sanctioned way to install Julia, so that is probably still a bit off.

PallHaraldsson commented 1 year ago

sudo apt install julia to install juliaup, would be great at some point, but not what I asked for, since it already gets you julia, not juliaup.

I do think juliaup is "the sanctioned way to install Julia" already, at least works, production ready. But as far as I know, you must install it and then with it install Julia, a version of your choosing.

I'm ok with that for sudo apt install juliaup. If you mean it's problematic that it would install a version automatically (the latest or LTS), then I'm ok with that and deferring that for sudo apt install julia.

StefanKarpinski commented 1 year ago

We can have it install juliaup and then have a trigger that installs the current release of Julia.

petvana commented 1 year ago

After sudo apt install juliaup, julia can be installed once you first call julia automatically.

PallHaraldsson commented 1 year ago

I support juliaup, and letting the user choose manually the Julia version, and/or preinstalling the latest LTS.

I'm not sure it's better to choose for the user e.g. 1.9, and then some other user installs later (even on same Ubunto distro) and will get 1.10 (and the other left with unsupported 1.9 or 1.8), and then we are relying on the (limited) forward compatibility of Julia, AND the package system being solid after an upgrade.

In Ubuntu you can install e.g. python3.8, python3.7 etc for some reason, but yes, python3 is a synonym for some version, and I believe a moving target across distros.

https://packages.ubuntu.com/search?keywords=python3.8

Julia isn't preinstalled, unlike Python which is the default scripting language. Since Julia isn't yet as good for quick-running scripts (by default, without hacks), then we shouldn't even try as much.

What we could do right away is add sudo apt install juliaup with the bahavor just as it is (no trigger, that could be added later).

BacAmorim commented 4 months ago

I would like to point out that there is a snap package for rustup: https://snapcraft.io/rustup

Having something similar for juliaup would be very convenient.

Also, notice that the installation command is snap install rustup, and not snap install rust. So this precedent would is an argument in favor of having snap install juliaup and not snap install julia (also notice that there is already a julia snap, https://snapcraft.io/julia, which installs the actual julia language and not the juliaup installer).