Can't upload BYOML model a second time

In my python notebook I created an sklearn linear regression model and uploaded it successfully. Now I created a new version which I want to upload as well. The problem is that I keep getting a 400 error and I don’t really know how to solve it.

1 Like

Hey Eric!

Could you maybe share how you are uploading the model and what error you are getting exactly? It should be possible to overwrite BYOML models.

1 Like

This is the python code I’m using at the moment:

byom_url = ''
resp =,
                     files={'file': ('', upload_file)},
                     data={'name': model_name, 'framework': 'sklearn', 'description': description},
                     auth=HTTPBasicAuth(api_key, api_secret))

And when I print out resp in the notebook it just says 400.

1 Like

Oh ok, I see!

So you are using a POST to overwrite a model, which will not work because now that the model exists, you should do a PUT to that model’s specific endpoint. This endpoint should look like this:

byom_url = ''

Where you fill in the right model name of course!

If you print the response message out like this: resp.text, it should also say something along the same lines:

{"error":"Model already exists, if you want to overwrite, use /models/<model-name>"}

I hope that helps you out!

1 Like

Thanks, yes that did the trick!

1 Like