Improved error message in Pkg.query.check_requirements

Closes #6401