Setting up Machine Learning Environment in Ubuntu/Linux
This post is for setting up a Machine Learning environment for your Machine Projects in Linux/Ubuntu. Also important to keep in mind that you should keep tract of your environment which help in reproducibility of the project. Here I am showing how easy to set up Machine Learning Environment with anaconda.
Conda Installer
Anaconda is an open-source platform for Python/R and machine Learning and available for linux, Windows and Mac OS X. It is the industry standard for developing, testing, and training on a single machine, enabling individual data scientists.
Installing Conda
To install the conda installer please follow the following command.
-
Donload Anaconda from the link https://www.anaconda.com/distribution/
-
Make it executables by using the following command
chmod a+x ./Anaconda3-2018.12-Linux-x86_64.sh
-
Run the command to install conda
./Anaconda3-2018.12-Linux-x86_64.sh
In order to continue the installation process, please review the license agreement. Please, press ENTER to continue Do you accept the license terms? [yes|no] [no] >>> yes Anaconda3 will now be installed into this location:
-
Next activate conda path
source .bashrc
-
Next step is to update conda. Navigate to the anaconda directory and run the following command
conda update conda
Create a new virtual environment using Conda
Virtual environment is highly recommeded for machine learning projects. Each virtual environment has its own environment and the installed packages. If any package damage or corrupt in one environment will not effect other environment. So, Lets create a virtual environment.
- Follow the conda command.
conda create –name “Enviroment_Name” python=3.7
Change the Enviroment_Name accordingly
- Activate the environment using
conda activate Enviroment_Name Once the environment is activated, environment name is added as prefix to the command prompt.
- Removing an environment
cond remove –name Enviroment_Name –all
- Installing other package for example
conda install cmake pip install scikit-learn
- To get a list of install packages
conda list
Migration of a conda Environment
Migrating a conda environment is pretty easy. Lets see how
- Fist we need to export the list of installed packages by using the following command.
conda env export > environment.yml
- Next is to create a new environment from the file
conda env create -f environment.yml
- That’s it. Done.
Enjoy working
Leave a comment