Adds package and requirement spec output to version check exception (#18702)
* Adds package and requirement spec output to version check exception
It's difficult to understand what package is affected when `got_ver`
here comes back None, so output the requirement and the package. The
requirement probably contains the package but let's output both for good
measure.
Non-exhaustive references for this problem aside from my own encounter:
* https://stackoverflow.com/questions/70151167/valueerror-got-ver-is-none-when-importing-tensorflow
* https://discuss.huggingface.co/t/valueerror-got-ver-is-none/17465
* https://github.com/UKPLab/sentence-transformers/issues/1186
* https://github.com/huggingface/transformers/issues/13356
I speculate that the root of the error comes from a conflict of
conda-managed and pip-managed Python packages but I've not yet proven
this.
* Combines version presence check and streamlines exception message
See also: https://github.com/huggingface/transformers/pull/18702#discussion_r953223275
Co-authored-by: Stas Bekman <stas@stason.org>