According to a Q&A on github "RuntimeWarning: invalid value encountered in true_divide (Theoretical_CDF * (1 - Theoretical_CDF))" can be simply ignored. Note that the data here should be values generated from a power-law distribution (or data samples that should follow a power-law), not the values representing frequency (i.e., not PDF).
import powerlaw
# powerlaw module can be installed by pip/pip3
# data: a list of values generated from a power-law distribution.
fitted_pl = powerlaw.Fit(data)
print(fitted_pl.alpha) # the power-law exponent of this data