How to Solve NameError: name 'PathMetadata' is not defined -- pkg_resources

Solution: Import the 'PathMetadata' module

# Add the following line to the top of your code
from pkg_resources import PathMetadata

 

For more information:
pkg_resources PathMetadata