Setting up Scikit-Learn & Conda.

Christoph Klemenjak
2 min readFeb 22, 2021

--

In this manual, we will set up a Conda environment for Scikit learn and Jupyter notebooks.

Virtual environments ease organising Python packages. Why Conda? Well:

“With over 6 million users, the open source Anaconda Distribution is the easiest way to do Python data science and machine learning. It includes hundreds of popular data science packages and the conda package and virtual environment manager for Windows, Linux, and MacOS. Conda makes it quick and easy to install, run, and upgrade complex data science and machine learning environments like Scikit-learn, TensorFlow, and SciPy. Anaconda Distribution is the foundation of millions of data science projects as well as Amazon Web Services’ Machine Learning AMIs and Anaconda for Microsoft on Azure and Windows.”

Get Anaconda for Python here.

Open a terminal window and start the installation from command line:

cd Downloads/
sudo bash Anaconda3-5.2.0-Linux-x86_64.sh -u

This will initiate the installation process, which will guide you through several steps. Install Conda and test the installation by executing the command conda in the command prompt.

In case the command conda results in a bad interpreter error, apply the following fix:

cd /home/user/
nano .bashrc

add the line: export PATH=~/anaconda3/bin:$PATH

Finally, execute the command:

source .bashrc

Now create a new Conda environment:

conda create --name eninf

Next, activate the freshly created environment:

conda activate eninf

Finally, we begin with installing software packages:

conda install scikit-learn matplotlib pandas jupyter

Alternatively, open Anaconda Navigator and use the graphical user interface.

Please mind that this is merely a symbolic image, as our environment is named eninf and there is no nilmtk.yml in this context.

Jupyter

The next step involves Jupyter notebooks. Add the environment to Jupyter:

python -m ipykernel install --user --name eninf --display-name "Python (eninf)"

Testing your Installation

The time has come to check your installation. Create a new folder and open Jupyter.

mkdir lab
jupyter notebook lab/

Create a new notebook and don’t forget to use “Python (eninf)”. Fill in the Vector Quantization example:

Here is what you should see now:

Congrats! You have made it.

--

--