I'm getting error when trying to register my model in the model registry. I logged in successfuly but when trying to save the model, it throws an error

HOPSWORKS_HOST = “c.app.hopsworks.ai”
HOPSWORKS_PORT = 443
API_KEY_VALUE = “my api key”
PROJECT_NAME = “Daniel_ML_project”

Log in to Hopsworks

project = hopsworks.login(
host=HOPSWORKS_HOST,
port=HOPSWORKS_PORT,
api_key_value=API_KEY_VALUE,
project=PROJECT_NAME
)

Access the model registry

mr = project.get_model_registry()

Define your model directory and other necessary files

model_dir = “iris_model”
if not os.path.exists(model_dir):
os.makedirs(model_dir)

Save the model to the model directory

joblib.dump(model, os.path.join(model_dir, “iris_model.pkl”))
shutil.copyfile(“/Users/danielabutu/Desktop/Hopswork pipeline/confusion_matrix.png”, os.path.join(model_dir, “confusion_matrix.png”))

Prepare input and output schema

input_example = X_train.sample()
input_schema = Schema(X_train)
output_schema = Schema(y_train)
model_schema = ModelSchema(input_schema, output_schema)

Create the model in the model registry

iris_model = mr.python.create_model(
version=1,
name=“iris”,
metrics={“accuracy”: metrics[‘accuracy’]},
model_schema=model_schema,
input_example=input_example,
description=“Iris Flower Predictor”
)

Save the model to the project dataset

try:
model_path = f"/Projects/{PROJECT_NAME}/Models/iris"
iris_model.save(model_path)
print(“Model saved successfully to the model registry.”)
except Exception as e:
print(f"An error occurred while saving the model: {e}")

Connection closed. Connected. Call .close() to terminate connection gracefully. Logged in to project, explore it here https://c.app.hopsworks.ai:443/p/665750 Connected. Call .close() to terminate connection gracefully. An error occurred while saving the model: Metadata operation error: (url: https://c.app.hopsworks.ai/hopsworks-api/api/project/665750/dataset/%2FProjects%2FDaniel_ML_project%2FModels%2Firis). Server response: HTTP code: 403, HTTP reason: Forbidden, body: b’{“errorCode”:320004,“errorMsg”:“No valid scope found for this invocation”}', error code: 320004, error msg: No valid scope found for this invocation, user msg: