Taylor Childers
Taylor Childers

Reputation: 393

Using Conda Environments with a 'read-only' base installation

I have installed miniconda-3 via the bash script on a linux system with many users. I set this base installation to read-only for all. Ideally, most users will simply run the following to run their python apps on their system.

eval "$(/path/to/bin/conda shell.bash hook)"

In the event they need custom packages, they can create a conda clone via

conda create -p /path/to/new/env --clone $CONDA_PREFIX

However, in this case user's environments are still using the base conda and its configuration which causes permissions errors if the user runs conda install ... like the following:

NotWritableError: The current user does not have write permissions to a required path.
  path: /path/to/miniconda3/pkgs/cache/9e0f62c3.json

Is there a way to cause the new environment to use its own pkg_dirs and env_dirs without the user needing to manually change them?

Upvotes: 3

Views: 4547

Answers (1)

FlyingTeller
FlyingTeller

Reputation: 20571

You should create a shared pkg_dirs. In short, this is a cache directory. When running conda install, it downloads packages from the public channels into this directory and then installs them.

The advantage of having this folder the same for each user will be that it will speed up installation as it will reduce downloads if packages are already in the cache from another user.

See this guide about details. Basically, you just have to add

pkgs_dirs:
    - /path/to/shared_directory

to your .condarc

Upvotes: 4

Related Questions