Handling Variable Division in CVXPY for Calculating Annualized Rate of Change

I am working with a dataset that contains multiple entries for different IDs across various years. Some IDs might have a gap of years between entries. My goal is to solve an optimization problem using CVXPY, where I impose constraints based on the annualized rate of change of a variable associated with each ID across years. When there are gaps between years for a given ID, I aim to consider the rate of change as evenly distributed across the gap years. For instance, if an ID has a 20% increase from the year 2010 to 2012, I calculate the annualized rate of change as $$\sqrt[2012-2010]{\frac{{\text{value2012}}}{\text{value2010}}}$$

However, when incorporating this logic into my CVXPY problem, I am encountering a DCPError: "Problem does not follow DCP rules".

Below is a simplified version of my code that illustrates the issue:

import cvxpy as cp

# Define CVXPY variables
vars = {
"value2010": cp.Variable(name="value2010"),
"value2012": cp.Variable(name="value2012"),
}

# Initialize constraints list
constraints = []
gap_years = 2012 - 2010
c = cp.Variable(nonneg=True)

# Calculate the annualized deviation and add the constraint
annualized_deviation = cp.power(vars["value2012"] / vars["value2010"], 1/gap_years)
constraints.append(cp.square(annualized_deviation - 1) <= c)