A step-by-step manual for installing NILMTK.

Christoph Klemenjak
3 min readFeb 21, 2021

--

In this manual, we will install the user version of NILMTK. Please note that this manual considers Mac OS and Linux systems only. The installation procedure for Windows might differ from the one presented in this blog post.

Publications related to this topic

  1. Klemenjak, C., & Goldsborough, P. (2016). Non-intrusive load monitoring: A review and outlook. arXiv preprint arXiv:1610.01191.
  2. Klemenjak, C., Makonin, S., & Elmenreich, W. (2020). Towards comparability in non-intrusive load monitoring: On data and performance evaluation. In 2020 IEEE power & energy society innovative smart grid technologies conference (ISGT) (pp. 1–5). IEEE.
  3. Klemenjak, C., Makonin, S., & Elmenreich, W. (2020). Investigating the Performance Gap between Testing on Real and Denoised Aggregates in Non-Intrusive Load Monitoring. arXiv preprint arXiv:2008.10985.

Sources

This manual builds on material provided by the NILMTK project:

Thanks for the great work!

Step 1: Download and Install Conda

Virtual environments makes organizing Python packages a piece of cake. Also, the NILMTK project offers several versions on Conda forge. First, get Anaconda here. Then, open a terminal window and start the installation from command line:

cd Downloads/
bash Anaconda3-2020.11-Linux-x86_64.sh -u

You will be guided through several steps. Install Conda and test the installation by executing the command conda in the command prompt:

conda

In case the command conda results in “a bad interpreter error” (i.e. no such file or directory error), apply the following fix:

cd /home/user/
nano .bashrc

add the line:

export PATH=~/anaconda3/bin:$PATH

Save the changes to the file and, finally, execute the command:

source .bashrc

Congrats, you just installed Conda.

Step 2: Installing NILMTK

Open a terminal window, create a new Conda environment and activate it:

conda create --name nilmtk-env
conda activate nilmtk-env

If not already present in your Conda installation, add the conda-forge to the list of channels:

conda config --add channels conda-forge

Finally, install the latest NILMTK version from conda-forge:

conda install -c nilmtk nilmtk=0.4.2

This may take a while. In the meantime, check out further packages on NILMTK’s Forge.

Update February 22nd: I have experienced some post-installation problems with NILMTK and Matplotlib. To fix them, apply the command:

conda install matplotlib=3.3.2

Step 3: Add a Jupyter Kernel

Basically, NILMTK is now installed on your computer. The next step involves Jupyter notebooks. Working with Jupyter opens up many possibilities and is said to be a must-have tool. Therefore, add the NILMTK environment to Jupyter:

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

Endgame: Test your Installation

The time has come to check your installation. Before anything else, create a new folder and download the random test set from Github:

mkdir nilmtk_test/
cd nilmtk_test/
wget https://raw.githubusercontent.com/nilmtk/nilmtk/master/data/random.h5

Next, fire up Jupyter:

jupyter notebook

To test your installation, try to import the random dataset using NILMTK and plot all meters:

The output should be:

MeterGroup(meters=
ElecMeter(instance=1, building=1, dataset=None, appliances=[])
ElecMeter(instance=2, building=1, dataset=None, appliances=[])
ElecMeter(instance=3, building=1, dataset=None, appliances=[])
ElecMeter(instance=4, building=1, dataset=None, appliances=[])
ElecMeter(instance=5, building=1, dataset=None, appliances=[])
)

Congrats! You have made it. NILMTK seems to work as intended! Next time, we will discuss how to use NILMTK’s API for rapid & convenient experimentation.

We are done for today, how about a coffee?

--

--