Table of Contents
In this article, I will take you through the steps to install Watson CLI in Linux using 7 easy steps. If you are working on a critical project that needs to be finished in a limited period of time or let's say if you want to measure the time spent on a particular project, then Watson CLI is one you should choose. You can just not only track the time spent on the project but you can also generate a nice report to show to your clients. There are some other important features Watson CLI provides which can be checked on its official website.
How Watson CLI works
When you are starting a project then you need to use
watson start command to start the timer and once you are done you can stop the timer by using
watson stop command. This will create a
frame which will contain the name of the project and some tags. You can share tags across the projects and can be used to generate detailed reports. Watson stores everything on your local system but you can also store the sessions in your own Watson backend crick server using
sync command. So that you can share the same with your colleagues.
How to Install Watson CLI in Linux Using 7 Easy Steps
Step 1: Prerequisites
a) You should have a running Linux(in our case it is
Ubuntu 20.04 LTS) System.
b) You should have Python
pip utility installed in your System.
c) You should have access to install package in your System.
Step 2: Update Your Server
In the first step, you need to update your Server package cache with all the latest available versions from the repo. If you are using a Debian/Ubuntu based systems, then you need to use
sudo apt-get update command as shown below.
cyberithub@ubuntu:~$ sudo apt-get update Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB] Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB] Get:5 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB] Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [710 kB] Get:7 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [483 kB] Get:8 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,051 kB] Get:9 http://in.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [366 kB] Get:10 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [278 kB] Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [15.8 kB] Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1,234 kB] Get:13 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,685 kB] Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [175 kB] Get:15 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [941 kB] ..............................................
If you are using RHEL/CentOS based systems, then you need to use
sudo yum update or
sudo dnf update command as shown below.
[cyberithub@centos8 ~]$ sudo dnf update CentOS Linux 8 - AppStream 60 kB/s | 4.3 kB 00:00 CentOS Linux 8 - BaseOS 37 kB/s | 3.9 kB 00:00 CentOS Linux 8 - Extras 9.9 kB/s | 1.5 kB 00:00 Dependencies resolved. Nothing to do. Complete!
Step 3: Install Watson CLI
There are multiple ways to install Watson CLI in a Linux System. You can use any of the method depending on the availability of tools and the version of Linux you are using.
a) Using PIP Utility
The best way to install Watson CLI is through pip utility where you just to use
pip install td-watson command to install the utility as shown below.
cyberithub@ubuntu:~$ pip install td-watson Collecting td-watson Downloading td_watson-2.1.0-py2.py3-none-any.whl (38 kB) Collecting arrow>=1.0.0 Downloading arrow-1.2.2-py3-none-any.whl (64 kB) |████████████████████████████████| 64 kB 2.0 MB/s Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from td-watson) (2.22.0) Collecting click>=8.0 Downloading click-8.1.3-py3-none-any.whl (96 kB) |████████████████████████████████| 96 kB 3.4 MB/s Collecting click-didyoumean Downloading click_didyoumean-0.3.0-py3-none-any.whl (2.7 kB) Requirement already satisfied: python-dateutil>=2.7.0 in /usr/lib/python3/dist-packages (from arrow>=1.0.0->td-watson) (2.7.3) Installing collected packages: arrow, click, click-didyoumean, td-watson WARNING: The script watson is installed in '/home/cyberithub/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed arrow-1.2.2 click-8.1.3 click-didyoumean-0.3.0 td-watson-2.1.0
b) Using apt-get utility
If you are using Debian or Ubuntu based systems, then you can also download the package from default Ubuntu repo using
sudo apt-get install watson command as shown below.
cyberithub@ubuntu:~$ sudo apt-get install watson Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libfwupdplugin1 Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: python3-arrow python3-watson Suggested packages: python-arrow-doc The following NEW packages will be installed: python3-arrow python3-watson watson 0 upgraded, 3 newly installed, 0 to remove and 46 not upgraded. Need to get 71.7 kB of archives. After this operation, 386 kB of additional disk space will be used. Do you want to continue? [Y/n] Y ......................................
c) Using snap utility
You can also install watson as a snap package from Snap store by using
sudo snap install watson command as shown below.
cyberithub@ubuntu:~$ sudo snap install watson watson 1.10.0-snap2 from Daniel Manrique (tomechangosubanana) installed
After successful installation, you need to set the locale every time you start the watson command or else it will through
"RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment" error every time.
cyberithub@ubuntu:~$ export LC_ALL=C.UTF-8 cyberithub@ubuntu:~$ export LANG=C.UTF-8
Step 4: Export PATH
If you have installed the CLI through pip utility then it must have installed the packages in local user bin directory which is usually not visible to the System. So to make it visible, we need to export the local user bin path to PATH environment variable using below
cyberithub@ubuntu:~$ export PATH=$PATH:/home/cyberithub/.local/bin cyberithub@ubuntu:~$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/cyberithub/.local/bin
Step 5: Start Tracking Your Project
Now that watson CLI is installed in your system, you can start tracking your project. To start a new frame for hello-world project with the test tag, use
watson start hello-world +test command as shown below.
cyberithub@ubuntu:~$ watson start hello-world +test Starting project hello-world [test] at 16:01
Step 6: Stop Tracking Your Project
Once your hello-world plan has been setup, you can stop the time tracking by using
watson stop command as shown below.
cyberithub@ubuntu:~$ watson stop Stopping project hello-world [test], started 24 seconds ago and stopped just now. (id: 76e50e8)
Step 7: Check all the Available Options
You can check all the options available with watson command using
watson help command as shown below.
cyberithub@ubuntu:~$ watson help Usage: watson [OPTIONS] COMMAND [ARGS]... Watson is a tool aimed at helping you monitoring your time. You just have to tell Watson when you start working on your project with the `start` command, and you can stop the timer when you're done with the `stop` command. Options: --version Show the version and exit. --color / --no-color (Don't) color output. --help Show this message and exit. Commands: add Add time to a project with tag(s) that was not tracked live. aggregate Display a report of the time spent on each project... cancel Cancel the last call to the start command. config Get and set configuration options.