'TypeError: __init__() got multiple values for argument 'marks'

I'm getting the following error of TypeError: __init__() got multiple values for argument 'marks' for the code below and I'm not sure how to best fix it. i know its referring to the marks however I'm unsure how this needs to be changed ? Thanks in advance

app = dash.Dash(__name__)
app.title = "Performance"
dfsites = pd.read_csv("3msites.csv")

colors = {
    "background": "#011833", 
    "text": "#7FDBFF"
} #Dictionary of colors to use later

fig1 = px.scatter(dfsites, x='Spend',y='CPA', 
                size= 'Conversions', color='Campaign', hover_name='Site',
                log_x=True)

)
app.layout = html.Div(children=[
    html.Div([
        html.H4(children='Sites', style={"textAlign": "center"}),

        dcc.Graph(
            id='site-graph',
            figure=fig1),
        dcc.Slider(
            dfsites['Month'].min(),
            dfsites['Month'].max(),
            step=None,
            value=dfsites['Month'].min(),
            marks={str(Month) for Month in dfsites['Month'].unique()},
            id='Month-slider'
    )  
]),
])

@app.callback(
    Output('site-graph', 'figure'),
    Input('Month-slider', 'value'))
def update_figure(selected_Month):
    filtered_dfsites = dfsites[dfsites.Month == selected_Month]

    fig1.update_layout(transition_duration=500)
    
    return fig1

if __name__ == '__main__':
    app.run_server(debug=True)

Traceback error:

Traceback (most recent call last):
  File "/Users/~/Dash.py", line 94, in <module>
    dcc.Slider(
  File "/Users/~/opt/anaconda3/lib/python3.8/site-packages/dash/development/base_component.py", line 366, in wrapper
    return func(*args, **kwargs)
TypeError: __init__() got multiple values for argument 'marks'


Solution 1:[1]

The argument you're passing to marks needs to be a dictionary.

{str(Month) for Month in dfsites['Month'].unique()} is a set.

You can create a dictionary comprehension with {Month: str(Month) for Month in dfsites['Month'].unique()} mapping each Month to its string representation

Solution 2:[2]

I experienced a similar error with the Dropdown component:

__init__() got multiple values for argument 'id'

In my case, I had to update dash:

pip3 install dash --upgrade

Moreover, I had to update the component configuration like this:

dcc.Dropdown(
   options=['New York City', 'Montreal', 'San Francisco'],
   value='Montreal'
)

(refer to the component reference documentation here: https://dash.plotly.com/dash-core-components)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Derek O
Solution 2 quent