close

How to change the path of conda base

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to change the path of conda base in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to change the path of conda base?

  1. How to change the path of conda base?

    The only difference between an Anaconda and a Miniconda installation is that, the “base” environment where conda is installed from Anaconda, is bundled with more pre-installed packages than the “base” env from Miniconda.

  2. change the path of conda base

    The only difference between an Anaconda and a Miniconda installation is that, the “base” environment where conda is installed from Anaconda, is bundled with more pre-installed packages than the “base” env from Miniconda.

Method 1

  1. Prepend condabin/conda into PATH. Write the following settings into your shell init files. ~/.bash_profile~/.bashrc for Bash, ~/.zshrc for ZSH.export PATH="/home/user/miniconda3/condabin:$PATH" Reopen a new shell. Check the result of which -a conda. Make sure the conda from /home/user/miniconda3/condabin takes precedence over other conda executables.
  2. Cleanup and redo conda init.Open your shell init files. Remove the following content,# >>> conda initialize >>> ... # <<< conda initialize <<< Save the configuration files.Reopen a new shell, type /home/user/miniconda3/condabin/conda init once.Done.

Update: But I still recommend you use the Anaconda already installed on your system. There’s no need to install two conda packages.

Because conda is a python manger and a package manager. You can create environments with any version of Python you want with command conda.

The only difference between an Anaconda and a Miniconda installation is that, the “base” environment where conda is installed from Anaconda, is bundled with more pre-installed packages than the “base” env from Miniconda.

Configuring conda to store environments under your home directory is enough.

conda config --prepend pkgs_dirs /home/user/.conda/pkgs
conda config --prepend envs_dirs /home/user/.conda/envs

All you need is the execution permission of the command conda, the environments and pkg caches are stored under your home folder.

Method 2

When one installs different distributions of Anaconda, the package shell scripts change the base environment. (That was what happened when I installed Miniforge3 to experiment with python for M1 Silicon)

Try to See: echo $PATH and one can see paths to active base environment but those paths wont be on ~/.bash_profile PATH

To change default/base environment follow below steps:

On Mac:

  1. Open your /Users/your username/.zshrc (in a TextEditor)
  2. There would be the paths to current base environment. Replace the path with the one which should be the default one for your case.
  3. Close and Reopen Terminal.
  4. Run ‘conda info –envs’ and the base env would be changed to path mentioned in ~/.zshrc

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read