Sunday, May 22, 2022

How to install Miniconda Environment in Linux

Download the latest Miniconda version from the official download page.

$ wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh

Go to the location where you downloaded the Miniconda installer and check the integrity of the downloaded file with SHA-256:

$ sha256sum Miniconda3-py39_4.9.2-Linux-x86_64.sh

You will see an output like below:

536817d1b14cb1ada88900f5be51ce0a5e042bae178b5550e62f61e223deae7c  Miniconda3-py39_4.9.2-Linux-x86_64.sh

Compare the above hash value with the official Hashes for Miniconda. If the hash value of the locally downloaded installer file matches with the official hash, it is a legitimate file and you can start the installation!

To install Miniconda on Linux, run:

$ bash Miniconda3-py39_4.9.2-Linux-x86_64.sh 

You should include the bash command regardless of the shell you're using.

Press ENTER to continue installation:

Welcome to Miniconda3 py39_4.9.2

In order to continue the installation process, please review the license agreement.

Please, press ENTER to continue                  

Next, you will see the license agreement. Press ENTER key to scroll to the bottom of the license terms and type “Yes” and press to agree the license agreement and continue installation.

Do you accept the license terms? [yes|no]

 [no] >>> yes

Next the installer will prompt where do you want to install Miniconda. You will be given three choices. Press ENTER to accept the default install location i.e. your $HOME directory. If you don't want to install in the default location, press CTRL+C to cancel the installation or mention an alternate installation directory.

I go with the default installation path, which is /var/home/sk/miniconda3 in my case.

[...]

Miniconda3 will now be installed into this location:

 /var/home/sk/miniconda3

 Press ENTER to confirm the location

 Press CTRL-C to abort the installation

 Or specify a different location below 

 [/var/home/sk/miniconda3] >>> 

If you've chosen the default location, the installer will display “PREFIX=/var/home/<user>/miniconda3” and continue the installation. It may take a few minutes to complete.


Finally, you will be prompted to initialize Miniconda. It is recommended to initialize it, so just type Yes and press ENTER to continue.


 [...]

 Preparing transaction: done

 Executing transaction: done

 installation finished.

 Do you wish the installer to initialize Miniconda3

 by running conda init? [yes|no]

 [no] >>> yes


Once the Miniconda installation is completed, you will see a thank you note at the end.


[...]

==> For changes to take effect, close and re-open your current shell. <==

 If you'd prefer that conda's base environment not be activated on startup, 

    set the auto_activate_base parameter to false: 

 conda config --set auto_activate_base false

 Thank you for installing Miniconda3!


For the installation to take effect, close and re-open your Terminal. Alternatively, run the following command to effect the changes immediately:

$ source ~/.bashrc

You will now see the prefix (base) in front of your shell prompt. It means that the conda's base environment is activated.

(base) [[email protected] ~]$ 

If you don't want the conda's base environment activated by default on system startup and wish to run conda from anywhere, deactivate it using command:

$ conda config --set auto_activate_base false

Run the following command to take effect the changes immediately:

$ source ~/.bashrc

From now on, you have to manually activate conda environment using command:

$ conda activate

To deactivate conda environment:

$ conda deactivate

0 comments:

Post a Comment