``[[ $flag ]]`` checks if the variable is not empty. Not if it's true or false. Which means it will always succeed, because both possible values (``true`` and ``false``) are not empty.
An alternative would be ``[[ "$flag" = "true" ]]``.
Fixes some points mentioned in #489. Doesn't address changing `pip` to `pip3` (or maybe even ``python3 -m pip``) or the missing detection of the version number.