Here is my environment in ubuntu 16 with VSCode to download leaf package :
owner@CNHKG-EX-001367:~/QMI/MBPL/R23/USB$ leaf --version
leaf version 2.1
owner@CNHKG-EX-001367:~/QMI/MBPL/R23/USB$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.7 LTS
Release: 16.04
Codename: xenial
owner@CNHKG-EX-001367:~/QMI/MBPL/R23/USB$ python --version
Python 2.7.9
owner@CNHKG-EX-001367:~/QMI/MBPL/R23/USB$ python3 --version
Python 3.5.3
Other user also makes it work on Ubuntu18 VM machine: