4

I want to connect to remote tracking server (http://123.456.78.90) that requires authentication

When I do this:

import mlflow
mlflow.set_tracking_uri("http://123.456.78.90")
mlflow.set_experiment("my-experiment")

I get an error

MlflowException: API request to endpoint /api/2.0/mlflow/experiments/list failed with error code 401 != 200. Response body: 401 Authorization Required

I understand that I need to log in first but I have no idea how to do it

1 Answers1

3

MLflow documentation says:

MLFLOW_TRACKING_USERNAME and MLFLOW_TRACKING_PASSWORD - username and password to use with HTTP Basic authentication. To use Basic authentication, you must set both environment variables.

So you just need to set these variables in your code using os.environ:

os.environ['MLFLOW_TRACKING_USERNAME'] = 'name'
os.environ['MLFLOW_TRACKING_PASSWORD'] = 'pass'
Alex Ott
  • 80,552
  • 8
  • 87
  • 132
  • Thanks, it worked! One more question, if I want to store artifacts in s3, what should I set as a tracking URL? mlflow or aws? – Ksenia Belozerova Nov 25 '21 at 10:13
  • It's really should be configure on the MLflow server: https://mlflow.org/docs/latest/tracking.html#scenario-4-mlflow-with-remote-tracking-server-backend-and-artifact-stores – Alex Ott Nov 25 '21 at 11:12
  • Getting MlflowException: API request to endpoint /api/2.0/mlflow/experiments/list failed with error code 403 != 200 – Soerendip Jan 31 '23 at 22:30