Search code examples
pythonubuntucondaminiconda

How to change conda base environment path on ubuntu?


I'm running out of space in my home directory, is there any way of changing the default path of the base environment to a new path like in another disk?


Solution

  • This is the best approach I find:

    set environment variable CONDA_ENVS_PATH to your desired path:

    # in ~/.bashrc
    export CONDA_ENVS_PATH=/media/my_disk/my-envs
    

    then clone your current base env into a new environment:

    conda create --name new_env --clone base
    

    set the new_env as the default environment:

    # in ~/.bashrc
    conda activate new_env
    

    this way you will not change the base environment but you'll have its clone that does the same job and you can delete the base env files and clean your home storage.

    PS: for every operation on above there are other ways like configuring .condarc but I kept it simple.