Wiki‎ > ‎

Anaconda env for multi-users

posted Sep 6, 2016, 10:03 PM by Dong Xu
https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/qinxkmvlnSg
sudo su -
adduser anaconda
mkdir /opt/anaconda
./path/to/Anaconda-latest.sh -b -p /opt/anaconda
chown -R anaconda:anaconda /opt/anaconda
chmod -R go-w /opt/anaconda
chmod -R go+rX /opt/anaconda

And then you can put /opt/anaconda/bin in the PATH added in /etc/profiles.d/anaconda.sh (or wherever). A (very) nice thing about Anaconda is that it requires no environment variables to be set. Adding it to your PATH is just for convenience.

You (as the sudo-empowered admin) can then go and create new environments for all users on the system:

sudo -u anaconda conda create -y -q -n python35minimal python=3.5
sudo -u anaconda conda create -y -q -n coolscience sklearn astropy scipy
sudo -u anaconda conda create -y -q -n dataviz matplotlib seaborn bokeh
sudo -u anaconda conda create -y -q -n r_rocks -c r r-essentials

And then any user, say janesmith can go and use these:

source activate coolscience # will add /opt/anaconda/envs/coolscience/bin to PATH

Additionally they can create their own envs:

conda create -n webdev django flask sqlalchemy pylons

which will (should) be created in ~janesmith/.conda/envs/webdev.

I have tested exactly 0% of the commands above, but they should point you in the right direction. Additionally, I must note, Conda is known to have “gotchas” that can come up when using it in a multi-user environment like this. A partial record of the challenges you may face are recorded in this issue:

https://github.com/conda/conda/issues/1329

==========================

We have an NFS network share export
called /APSshare.  In that, we have both 64 and 32 bit distributions.
This is available read-only to all except an administrator account (an
account with write permissions to that directory tree).  Looks like this:
/APSshare/anaconda/
   x86_64/
     bin
     lib
     ...
   x86/
     bin
     lib
     ...

I maintain a text file /APSshare/anaconda/HISTORY.txt that summarizes
any "conda update ..." or "pip install ..." or other maintenance
activity so users can have a view of what changed and when.

For maintenance, I keep tuned into this Google forum and watch for
problems or solutions.  Every week or so, I run "conda update conda" to
keep things updated.

Individuals can create their own virtual environments within their own
home directories.  Individuals can also install their own alternative
python distributions (in other directory paths) as they so choose.  For
example, I keep a personal distribution in /local/Apps/anaconda and test
upgrades before posting them on the public export path.  The sysAdmins
maintain the system python (/usr/bin/python) as required by operating
system needs.

As for documentation, this needs nothing exceptional.  The sysAdmins
manage the read-only NFS export, the account permissions, and provide
generous disk space.  Users opt to add one of the distributions to their
environment PATH (or call the desired version with an absolute path name).


==============Between regular users

http://conda.pydata.org/docs/using/envs.html#share-an-environment

NOTE: If you already have an environment.yml file in your current directory, it will be overwritten with the new file.

Export your active environment to the new file:

All users: conda env export > environment.yml

NOTE: This file handles the environment’s pip packages as well as its conda packages.

Email or copy the exported environment.yml file to the other person.

The other person will then need to create the environment by the following command:

conda env create -f environment.yml


Comments