Command Cheatsheet: Checking Versions of Installed Software / Libraries / Tools for Deep Learning on Ubuntu 16.04

In the previous posts, we’ve walked through the installations and configurations for various components and libraries required for doing deep learning / artificial intelligence on a Ubuntu 16.04 box. The next step is to be productive, crunching codes and solving problems by applying various algorithms. At this stage, visits to StackOverflow, Github or other similar sites become more frequent. And here is when the problem may arise. Not all codes or snippets copied and pasted from such online references can immediately work. One of the reasons is that the code was indeed written for same software, library, or tool but at different version.

Interestingly, software components for machine learning present different way to obtain the versions. These variations can sometimes result in additional time spent to query “ubuntu get xyz version” on the search engine. This is okay for one component, but when the system becomes complex enough (for example machine learning meets big data for ETL), this can turn into a productivity killer due to unjustifiable time taken for navigating the search engine.

Why not build a list for that?

This post summarizes the shell commands used for obtaining the versions of machine learning-related software and libraries. Commands are embodied in categories that reflect the logical / functional unit the software component belongs to.

Category: System

– Get Ubuntu version

$ lsb_release -a| grep "Release" | awk '{print $2}'

– Get Linux kernel version

$ uname -r

– Get GCC version

$ gcc --version | grep "gcc" | awk '{print $4}'

– Get Java version

$ java -version

– Get Python version

$ python --version

– Get Docker version

$ docker -v | awk '{print $3}' | sed 's/,//'

Category: GPU

– Get NVidia display driver version

$ nvidia-smi | grep "Driver Version" | awk '{print $6}' | cut -c2-

– Get CUDA toolkit version

$ nvcc --version | grep "release" | awk '{print $6}'

– Get cuDNN version

$ locate cudnn | grep "libcudnn.so." | tail -n1 | sed -r 's/^.*\.so\.//'

If you see the error “bash: locate: command not found”, it means that the “locate” command is not available. We can install the command first as follows:

$ sudo apt-get install mlocate

Alternatively, we can use “find” command to check the cuDNN version:

$ find /usr -name "*cudnn.so.*" | head -n1 | sed -r 's/^.*\.so\.//'

– Get NCCL version

$ locate nccl| grep "libnccl.so" | tail -n1 | sed -r 's/^.*\.so\.//'

– Get NVidia Docker version

$ nvidia-docker --version | awk '{print $3}' | sed 's/,//'

Category: Python Module

– Get pip version

$ pip --version | awk '{print $2}'

– Global command to get MODULENAME version

$ python -c 'import MODULENAME as mod; print(mod.__version__)'

– Get TensorFlow version

$ python -c 'import tensorflow as tf; print(tf.__version__)'

– Get Keras version

$ python -c 'import keras; print(keras.__version__)'

– Get Numpy version

$ python -c 'import numpy; print(numpy.__version__)'

– Get Pandas version

$ python -c 'import pandas; print(pandas.__version__)'

– Get Matplotlib version

$ python -c 'import matplotlib; print(matplotlib.__version__)'

Category: Tool

– Get Jupyter notebook version

$ jupyter --version

– Get IPython version

$ ipython --version

Concluding Remark

What command is missing? Put your suggestion in the comment section so that the list can get updated.

One thought on “Command Cheatsheet: Checking Versions of Installed Software / Libraries / Tools for Deep Learning on Ubuntu 16.04

  1. Pingback: Installing CUDA Toolkit 9.2 on Ubuntu 16.04: Fresh Install, Install by Removing Older Version, Install and Retain Old Version | Amikelive | Technology Blog

Leave a Reply

Your email address will not be published. Required fields are marked *