fpdf2 2.8.4 supports table - fpdf 1.7.2 doesn't
fpdf2 is a fork from fpdf and both share the same namespace. Your code must be using fpdf instead of fpdf2, that's why you are getting this error.
The easiest way to fix your issue is uninstalling fpdf 1.7.2 to make sure fpdf2 will be used. If you need the legacy version for a specific use case you might need to setup different virtual environments to manage your code dependencies.