I work in an academic environment where lots of users with very limited home directory quotas are trying to spin up conda environments and running are out of space. So I’ve been working on setting up a multi-user miniconda base on an NFS filesystem shared to all (linux) desktops. What I can’t do is make any of the directories in /mnt/opt/miniconda world or even group writable (as suggested here: Installing for multiple users — Anaconda documentation) because we have many hundreds of users and not all of them are trustworthy. Even so, this works fairly well save for one detail. I took a run at this a few years ago and made notes suggesting that if an ordinary user activates a shared environment and tries to
conda install a package, it goes to ~/.conda/pkgs rather than the shared location (they don’t have write access to), but the package is nevertheless accessible to them from the activated environment. Testing this with the current version of conda (23.7.4), this clearly doesn’t work and I’m not sure what I was doing previously.
The second best solution is to set up /mnt/opt/miniconda/user-envs/$USER folders which are writable by $USER, so that all environments are on the same filesystem. Astute readers will notice that packages installed in users ~/.conda directories will be actual packages and not hard links, because you can’t hard link across filesystems.
This doesn’t work unless you also set CONDA_PKGS_DIRS:
export CONDA_PKGS_DIRS=/home/$USER/.conda/pkgs export CONDA_ENVS_DIRS=/mnt/opt/miniconda/user-envs/$USER
This works, but when you activate an environment from $USER the prompt becomes the full path to the environment location. In this example, the first activated environment is from the shared environment, the second is one I set up under $USER:
$ source /mnt/opt/miniconda/bin/activate (base) pgoetz@texas-tea ~$ conda activate numpy (numpy) pgoetz@texas-tea ~$ conda activate pytorch (/mnt/opt/miniconda/user-envs/pgoetz/pytorch) pgoetz@texas-tea ~$
It would be nicer if the prompt were just
(pytorch) pgoetz@texas-tea ~$
Is there any way to make this happen?