Error Loading Layout in python 3.6, caused by json.dumps

I have built a dashboard in python 3.8 that works fine, but when i try to use it on python 3.6 I get a “Error loading layout” on the browser and on the console I get the following traceback.

Also all the packages have the same versions in both versions of python.

Does anyone know how to solve?

Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\dash\dash.py", line 532, in serve_layout
    json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder,sort_keys=False),
  File "C:\Users\user\Anaconda3\envs\dash\lib\json\__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "C:\Users\user\Anaconda3\envs\dash\lib\site-packages\_plotly_utils\utils.py", line 59, in encode
    encoded_o = super(PlotlyJSONEncoder, self).encode(o)
  File "C:\Users\user\Anaconda3\envs\dash\lib\json\encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "C:\Users\user\Anaconda3\envs\dash\lib\json\encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: keys must be a string
127.0.0.1 - - [07/Dec/2020 19:36:18] "e[35me[1mGET /_dash-layout HTTP/1.1e[0m" 500 -```