HOW to install ana/miniconda for machine learning

Anaconda/Miniconda is a package manager that allows the installation and environment management of GPU and python packages. While anaconda is the full version of miniconda, this guide focuses on CLI only installation of miniconda. You can install Anaconda in a similar way.

DOWNLOAd miniconda

Please note that the following guide is primarily a bash based installation guide. It may differ slightly for mac based ZSH, and this is possible on Windows powershell but you should REALLY just use WSL2 at this point.

Miniconda can be grabbed from the following url:
https://docs.anaconda.com/miniconda/#latest-miniconda-installer-links

Linux_x86:
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Or by using the following command:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

install miniconda

You can install miniconda using the following simple command:

bash Miniconda3-latest-Linux-x86_64.sh

Press enter to being the installation:

Agree to the terms and conditions by typing yes:

Type in the installation directory or click enter for the default installation path (recommended)

Finally, configure the default start behavior of miniconda, hence forth reference as conda. It is highly recommended to say yes to always on, because otherwise you will have to activate your environments with two commands instead of just one. Type yes:

Reboot your system using the command:

sudo reboot

If you have done the following steps correctly, when you re-login, you will now see (base) on the other side of your information:

how to configure an enviroment

Now that you have Miniconda installed, you can create, update, and manage your python installation packages. Below is some quick cheat sheet information for various useful commands.

conda create —name MyCondaEnvName

Create a new conda enviroment with packages:

To create a new Conda environment w/packages, you can use the following command:

conda create —name MyCondaEnvName mypackage1=3.3 mypackage2 mypackage3=4.5

Create a new conda enviroment without packages:

To create a new Conda environment, you can use the following command:

For example, to create a python envrioment with python 3.11, pandas, and jupyterlab, you could use the command:

conda create --name pythonForML python=3.11 pandas jupyterlab

For more complex packages like Tensorflow, you can even specify other channels. For example, to create a python environment that also pulls from conda-forge channels with python 3.11, and Tensorflow plus other packages, you could use the command:

conda create -c conda-forge --name testEnv2 python=3.11 tensorflow jupyterlab matplotlib pandas

How to manage conda enviroments

Once the conda environment has been created, you can switch between it and multiple other environments with the following commands.

list conda enviroments

To list the conda environments on your current machine, you can use the command:

conda env list

Activate a conda environment

To activate a conda environment, use the command:

conda activate myEnvironment

Deactivate conda environment

To deactivate the current conda enviroment, type

conda deactivate

Remove a conda environment

To deactivate the current conda environment and delete all packages:

conda remove --name myEnvironment --all

EXPORT a conda environment

Activate the conda environment you want to export, and then run the following command:

conda env export > myEnvironment.yaml

LOAD a conda environment

To load an exported conda environment, you can use the command:

conda env create -f myEnvironment.yaml