Error on copying graph object

I am getting python error while making a deepcopy of an igraph object.

g = igraph.Graph(directed=True)
g.add_vertices(sorted(set(terms)))
g.add_edges(from_to.keys())
g.es['weight'] = from_to.values() # based on co-occurence within sliding window
g.vs['weight'] = g.strength(weights=list(from_to.values())) # weighted degree
  
gg = copy.deepcopy(g)

Error from console:

  File "C:\ProgramData\Anaconda3\lib\copy.py", line 169, in deepcopy
    rv = reductor(4)

TypeError: can't pickle dict_values objects

Please show a complete minimal example, and include your igraph and Python versions.