OpenStack: Install OpenStack client

# install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"

# install python 3.5.x version into pyenv (DO NOT USE VERSIONS > 3.5.x)
apt install build-essential libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget curl libncurses5-dev libncursesw5-dev xz-utils libffi-dev liblzma-dev
pyenv install 3.5.6
echo '3.5.6' > ~/.python-version # python 3.5.6 will be used ONLY if your pwd is ~/

# install all openstack clients
cd ~/
pip install -U pip
pip install -U python-openstackclient python-keystoneclient python-cinderclient python-novaclient \
python-neutronclient python-glanceclient python-octaviaclient python-swiftclient python-heatclient \
python-magnumclient python-barbicanclient python-mistralclient \
pankoclient gnocchiclient

# extend bach_completion
openstack complete | sudo tee /etc/bash_completion.d/osc.bash_completion > /dev/null
. /etc/bash_completion

# test
# source foo-stage-openrc.sh
# openstack image list

# ubuntu default packages
sudo apt install -y python-openstackclient python-keystoneclient python-cinderclient python-novaclient python-neutronclient python-glanceclient python-octaviaclient python-swiftclient python-heatclient python-magnumclient python-barbicanclient python-mistralclient python3-pankoclient python3-gnocchiclient

Links
https://github.com/pyenv/pyenv