Specify package install location conda

1

Is there a way to specify, on the command line, where conda installs packages and finds prereqs? When I create a new package with conda create --prefix /path/to/whereiwantstuff/envs/envname pkg1 pkg2 the environment lives where I told it to, but packages are still installed to the first location under pkgs_dirs in my .condarc (or the default ~/.conda/pkgs); there doesn't seem to be a command line option to specify where packages go.

The end goal is to enable users to create both group and individual environments. Perhaps users A, B, and C of group ABC use a given set of software, but said software can't/shouldn't be installed system wide (e.g niche software in an HPC environment). Ideally there would be a /path/to/group_dir/.conda where both environments and packages would go, and which could be accessed by anyone who had the right permissions and the following in their .condarc:

envs_dirs:
  - ~/.conda/envs
  - /path/to/group_dir/.conda/envs
pkgs_dirs:
  - ~/.conda/pkgs
  - /path/to/group_dir/.conda/pkgs

Is this possible without doing something hackish like constantly modifying .condarc or manually moving packages?

Michael Greenburg

Posted 2018-06-01T17:52:43.160

Reputation: 31

Answers

2

I never ended up finding a command line parameter, but was able to accomplish the same purpose with environment modules. The environment variables CONDA_ENVS_PATH and CONDA_PKGS_DIRS allow one to use arbitrary directories for Conda environments and packages. Setting these and CONDARC (described here) in a modulefile allows one to load the group conda module, then not worry about where environments and packages end up.

Here's a slightly simplified version of the modulefile:

#%Module1.1

conflict        miniconda
module-whatis   "Provides group Miniconda"

set             PREFIX          "/path/to/group/software/miniconda3"
set             GROUP_CONDA     "/path/to/group/software/.conda"

prepend-path    PATH            "${PREFIX}/bin"
setenv          CONDARC         "${GROUP_CONDA}/.condarc"
setenv          CONDA_ENVS_PATH "${GROUP_CONDA}/envs"
setenv          CONDA_PKGS_DIRS "${GROUP_CONDA}/pkgs"

Michael Greenburg

Posted 2018-06-01T17:52:43.160

Reputation: 31