Zulip Chat Archive
Stream: lean4
Topic: installing Lean on university computer
Floris van Doorn (Oct 21 2024 at 14:52):
I want to install on some university computers, and I have a few questions:
- Once VSCode (and git) is installed on Ubuntu, does one require root access to install Lean itself?
- The home directory is on an old and slow (and remote) file server. If I have a symlink in
~/.elan
and~/.cache
to another folder, will Lean (and the cache) respect these symlinks? - Or alternatively, is it still possible to set
LEAN_PATH
or a similar environment variable to set the location for elan and the cache?
Julian Berman (Oct 21 2024 at 15:17):
ELAN_HOME
is the envvar for telling elan where to put stuff (i.e. it defaults to ~/.elan
)
Jannis Limperg (Oct 21 2024 at 15:23):
I think I tried a symlinked ~/.elan
at some point and it caused problems, but I don't recall the details. Root should not be necessary to install elan and Lean.
François G. Dorais (Oct 21 2024 at 16:51):
Does ELAN_HOME
just control where elan is or does it also control where the cache is?
Eric Wieser (Oct 21 2024 at 17:35):
You can also use elan toolchain link
to point it at a toolchain stored somewhere else, so that only elan
itself runs from the slow directory
Floris van Doorn (Oct 21 2024 at 17:38):
Cache seems to be controlled by the environment variable XDG_CACHE_HOME
(source)
Floris van Doorn (Oct 21 2024 at 17:40):
I'll try setting ELAN_HOME
and XDG_CACHE_HOME
before doing any Lean-install, and hopefully that will result in my home directory not being used at all.
François G. Dorais (Oct 21 2024 at 19:46):
Please let us know how that works out! I personally need to do the same kind of thing here in the near future.
Kevin Buzzard (Oct 21 2024 at 21:22):
What does the blind sudo in the standard Linux set-up script do if root isn't needed?
Jannis Limperg (Oct 21 2024 at 21:42):
This script? The sudo
s install git, curl and VSCode.
François G. Dorais (Oct 25 2024 at 02:36):
Floris van Doorn said:
I'll try setting
ELAN_HOME
andXDG_CACHE_HOME
before doing any Lean-install, and hopefully that will result in my home directory not being used at all.
Apologies for my impatience, did it work?
Floris van Doorn (Oct 25 2024 at 07:38):
I haven't tried yet, and it will probably take another week for me to try to do this setup.
Floris van Doorn (Feb 05 2025 at 12:43):
Sorry, I forgot to report back here. This is all working perfectly.
Ruben Van de Velde (Feb 05 2025 at 14:40):
Do you want to write up what you did exactly? :)
Floris van Doorn (Feb 05 2025 at 18:54):
It was done in collaboration with the IT-support here in Bonn, so I didn't execute all commands myself.
But basically, if you set the ELAN_HOME
and XDG_CACHE_HOME
environment variables before you do the Lean installation (and make sure these environment variables persist on later logins), then those are the places where Lean toolchains and compressed .olean
caches are stored, and you can ensure that your home directory is not touched at all.
(note: in @Julian Berman mentions you can also set $MATHLIB_CACHE_DIR
instead of $XDG_CACHE_HOME
)
Julian Berman (Feb 05 2025 at 19:00):
I'm not in front of lean but I may have misremembered whether MATHLIB_CACHE_DIR still exists these days -- it definitely did in lean 3 (I wrote the line which did it) but glancing at cache says maybe it does not anymore: https://github.com/leanprover-community/mathlib4/blob/24c597596e1eab32ef9047e2ca944e099df3d294/Cache/IO.lean#L47 so you may really just have XDG_CACHE_HOME at this point
Julian Berman (Feb 05 2025 at 20:19):
If someone is interested in having that work, https://github.com/leanprover-community/mathlib4/pull/21480 adds it.
Kim Morrison (Feb 06 2025 at 01:28):
I would love to have a CI workflow that installs things using this setup, so:
- we can remain confident that the setup continues to work
- if done nicely, people could even use it as a template to crib from
François G. Dorais (Feb 06 2025 at 01:39):
I'm a little bit concerned about setting XDG_CACHE_HOME since that's not a lean/lake/elan specific variable. I'm also concerned about Windows/VMWare installs since Windows remarkably sucks at sharing. Does anyone know enough about this to relieve/confirm my concerns?
Kim Morrison (Feb 06 2025 at 01:41):
@François G. Dorais, #21480 above allows you to set MATHLIB_CACHE_DIR instead of XDG_CACHE_HOME.
Kim Morrison (Feb 06 2025 at 01:41):
I don't understand what your concern is about Windows/VMWare. Are you saying you don't think this setup will work? Or something else?
François G. Dorais (Feb 06 2025 at 01:45):
Yes. I'm concerned because Windows/VMWare loves to lock files when another process uses them. I want all my students to be able to access the cache files at the same time (read only) but that hasn't been working reliably for me.
PS: I'm not a habitual Windows user so much of this may be due to my ignorance.
François G. Dorais (Feb 06 2025 at 02:37):
PPS: I'm hoping we will move away from VMWare but universities move slowly...
Last updated: May 02 2025 at 03:31 UTC