Reputation: 2171
I have Anaconda 5.1 Python distribution installed (by the system admin) on Windows 10, for all users. I can create an environment and then view the available environments:
λ conda create --name py35 python=3.5 anaconda
...
λ conda env list
# conda environments:
#
base * C:\ProgramData\Anaconda3
py35 C:\Users\<my-user-name>\AppData\Local\conda\conda\envs\py35
When I log in as a different user, however, only the base
environment is visible/available. How can I create an environment and make it available to all users of the system?
The documentation discusses multi-user installations, but I cannot see how to make environments available to other users.
Upvotes: 38
Views: 63394
Reputation: 71
1- If you want to add a directory to the environment directories you can use this command:
conda config --add envs_dirs the/path/to/my/env
You need to replace "the/path/to/my/env" with the full path to the env folder. For example, if I want to add the following path to environment directories
D:\Anaconda3\envs
I'll execute
conda config --add envs_dirs D:\Anaconda3\envs
To see the list of all environment directories (and other configs) you can run this:
conda config --show
2- A better way to do this is to create the environment in a directory accessible to all users. To do that you can create the Conda env using "--prefix" or "-p" like the following command:
conda create --prefix the/path/to/my/env
For activation:
conda activate the/path/to/my/env
For example:
conda create --prefix "D:/Shared_Conda_Env"
which can be activated by all users using
conda activate "D:/Shared_Conda_Env"
Upvotes: 0
Reputation: 31
In case Linux user will be interested, I find a most easiest way to figure out this issue, as long as the other person open the corresponding permission to you, you can simply soft link it to your own env folder:
presuming you are using miniconda, soft link the other user's env folder (ex. Python312) to your own ~/miniconda3/envs
cd ~/miniconda3/envs/
ln -s /home/to/otheruser/miniconda3/envs/Python312 ./
that's it, you can find a new env by 'conda env list' without switching to other user or exporting path etc.
Upvotes: 1
Reputation: 1675
The Conda-Cheatseet here lists these following commands.
Save Environment:
conda list --explicit > my-env.txt
Create Environment:
conda env create --file my-env.txt
Upvotes: 3
Reputation: 2171
The key here is adding the path to the folder containing the environment(s) to the user's conda configuration file .condarc
. Like this:
envs_dirs:
- C:\full\path\to\environments\folder
This makes all the environments (subfolders within) available to the user. It does not appear to be possible to make a specific, named environment available.
As has been pointed out, you can create an environment in a specific location using the -p
flag, and then add the parent directory to the configuration file, but this is not a requirement. This may be useful, however, to avoid permissions errors if sharing environments that exists in protected user areas.
On Windows 10, my user configuration file was in C:\Users\<my-user-name>\
, and I just added the above text to the end of it.
Upvotes: 18
Reputation: 10429
I would shy away from sharing environments with other users, because if they don't know what they are doing, they could add packages that could conflict with other packages and/or even delete packages that another user might need. The preferred approach is that after you have created an environment, you export it as a yml file:
conda env export > environment.yml
Then you send the users the yml file and have them build their own environment using the yml:
conda env create -f environment.yml
If you really want to use a shared environment where every user can access, then you have to use the -p
or --prefix
option in your create:
conda create -p C:/full/public/path/to/py35 python=3.5
And then instruct your users to add the public path (C:/full/public/path/to
) to their conda config file. Then, they should be able to see the environment when running conda env list
.
Upvotes: 35