<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error Unable to Register Model to Unity Catalog in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120358#M46146</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166099"&gt;@NicolaCompton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a common issue when running MLflow in Databricks environments.&lt;BR /&gt;The "Resource temporarily unavailable" error typically indicates a file system or process locking issue.&lt;BR /&gt;Here are several solutions to try:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Immediate Fixes&lt;/STRONG&gt;&lt;BR /&gt;1. Set MLflow tracking URI explicitly:&lt;/P&gt;&lt;P&gt;import mlflow&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Set the tracking URI to use Databricks workspace&lt;BR /&gt;mlflow.set_tracking_uri("databricks")&lt;/P&gt;&lt;P&gt;# Or try setting it to the workspace URL&lt;BR /&gt;# mlflow.set_tracking_uri("databricks://your-workspace-url")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Configure MLflow registry URI:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# For Unity Catalog&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;# Then proceed with your model registration&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;mlflow.register_model(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Add retry logic:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;import time&lt;BR /&gt;import mlflow&lt;BR /&gt;from mlflow.exceptions import MlflowException&lt;/P&gt;&lt;P&gt;def register_model_with_retry(model_uri, model_name, max_retries=3):&lt;BR /&gt;for attempt in range(max_retries):&lt;BR /&gt;try:&lt;BR /&gt;return mlflow.register_model(model_uri, model_name)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;if "Resource temporarily unavailable" in str(e) and attempt &amp;lt; max_retries - 1:&lt;BR /&gt;print(f"Attempt {attempt + 1} failed, retrying in 5 seconds...")&lt;BR /&gt;time.sleep(5)&lt;BR /&gt;else:&lt;BR /&gt;raise e&lt;/P&gt;&lt;P&gt;# Use it like this:&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;register_model_with_retry(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 May 2025 18:08:15 GMT</pubDate>
    <dc:creator>lingareddy_Alva</dc:creator>
    <dc:date>2025-05-27T18:08:15Z</dc:date>
    <item>
      <title>Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120321#M46137</link>
      <description>&lt;P&gt;I am following the examples outlined here:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;A class="" title="https://learn.microsoft.com/en-us/azure/databricks/machine-learning/manage-model-lifecycle/" href="https://learn.microsoft.com/en-us/azure/databricks/machine-learning/manage-model-lifecycle/" target="_blank" rel="noreferrer noopener"&gt;https://learn.microsoft.com/en-us/azure/databricks/machine-learning/manage-model-lifecycle/&lt;/A&gt;&amp;nbsp;to register a model to unity catalog.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I keep getting this error :&amp;nbsp;&lt;SPAN class=""&gt;BlockingIOError: &lt;/SPAN&gt;&lt;SPAN&gt;[Errno 11] Resource temporarily unavailable: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NicolaCompton_0-1748352021736.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/17150iB846BBD6BB71A34F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NicolaCompton_0-1748352021736.png" alt="NicolaCompton_0-1748352021736.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any ideas how to resolve this?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 13:21:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120321#M46137</guid>
      <dc:creator>NicolaCompton</dc:creator>
      <dc:date>2025-05-27T13:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120358#M46146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166099"&gt;@NicolaCompton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a common issue when running MLflow in Databricks environments.&lt;BR /&gt;The "Resource temporarily unavailable" error typically indicates a file system or process locking issue.&lt;BR /&gt;Here are several solutions to try:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Immediate Fixes&lt;/STRONG&gt;&lt;BR /&gt;1. Set MLflow tracking URI explicitly:&lt;/P&gt;&lt;P&gt;import mlflow&lt;BR /&gt;import os&lt;/P&gt;&lt;P&gt;# Set the tracking URI to use Databricks workspace&lt;BR /&gt;mlflow.set_tracking_uri("databricks")&lt;/P&gt;&lt;P&gt;# Or try setting it to the workspace URL&lt;BR /&gt;# mlflow.set_tracking_uri("databricks://your-workspace-url")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Configure MLflow registry URI:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# For Unity Catalog&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;# Then proceed with your model registration&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;mlflow.register_model(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. Add retry logic:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;import time&lt;BR /&gt;import mlflow&lt;BR /&gt;from mlflow.exceptions import MlflowException&lt;/P&gt;&lt;P&gt;def register_model_with_retry(model_uri, model_name, max_retries=3):&lt;BR /&gt;for attempt in range(max_retries):&lt;BR /&gt;try:&lt;BR /&gt;return mlflow.register_model(model_uri, model_name)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;if "Resource temporarily unavailable" in str(e) and attempt &amp;lt; max_retries - 1:&lt;BR /&gt;print(f"Attempt {attempt + 1} failed, retrying in 5 seconds...")&lt;BR /&gt;time.sleep(5)&lt;BR /&gt;else:&lt;BR /&gt;raise e&lt;/P&gt;&lt;P&gt;# Use it like this:&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;register_model_with_retry(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 May 2025 18:08:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120358#M46146</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-05-27T18:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120386#M46152</link>
      <description>&lt;P&gt;Thank you for your response.&lt;/P&gt;&lt;P&gt;Unfortunately, none of these solutions have worked for me. I think the issue is with getting the run_id. Do you have any ideas how to solve this?&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 08:28:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120386#M46152</guid>
      <dc:creator>NicolaCompton</dc:creator>
      <dc:date>2025-05-28T08:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120460#M46171</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166099"&gt;@NicolaCompton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at your error, the issue is that run_id is not defined when you try to use it.&lt;BR /&gt;The problem is in how you're getting the run ID from the MLflow run object.&lt;BR /&gt;Here are the correct ways to fix this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 1: Fix the run_id extraction&lt;/STRONG&gt;&lt;BR /&gt;The issue is in your code where you have:&lt;BR /&gt;autolog_run = mlflow.last_active_run()&lt;BR /&gt;model_uri = "runs:{}/model".format(autolog_run.info.run_id) # This line has the error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The correct way:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;import mlflow&lt;BR /&gt;from sklearn import datasets&lt;BR /&gt;from sklearn.ensemble import RandomForestClassifier&lt;/P&gt;&lt;P&gt;# Set tracking URI&lt;BR /&gt;mlflow.set_tracking_uri("databricks")&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;# Start MLflow run explicitly&lt;BR /&gt;with mlflow.start_run() as run:&lt;BR /&gt;# Train model&lt;BR /&gt;X, y = datasets.load_iris(return_X_y=True, as_frame=True)&lt;BR /&gt;clf = RandomForestClassifier(max_depth=7)&lt;BR /&gt;clf.fit(X, y)&lt;BR /&gt;&lt;BR /&gt;# Log model&lt;BR /&gt;mlflow.sklearn.log_model(clf, "model")&lt;BR /&gt;&lt;BR /&gt;# Get run_id from the active run&lt;BR /&gt;run_id = run.info.run_id&lt;BR /&gt;&lt;BR /&gt;# Register model&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;mlflow.register_model(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 2: Use mlflow.active_run() instead&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;import mlflow&lt;BR /&gt;from sklearn import datasets&lt;BR /&gt;from sklearn.ensemble import RandomForestClassifier&lt;/P&gt;&lt;P&gt;mlflow.set_tracking_uri("databricks")&lt;BR /&gt;mlflow.set_registry_uri("databricks-uc")&lt;/P&gt;&lt;P&gt;with mlflow.start_run():&lt;BR /&gt;# Train model&lt;BR /&gt;X, y = datasets.load_iris(return_X_y=True, as_frame=True)&lt;BR /&gt;clf = RandomForestClassifier(max_depth=7)&lt;BR /&gt;clf.fit(X, y)&lt;BR /&gt;&lt;BR /&gt;# Log model&lt;BR /&gt;mlflow.sklearn.log_model(clf, "model")&lt;BR /&gt;&lt;BR /&gt;# Get current active run&lt;BR /&gt;current_run = mlflow.active_run()&lt;BR /&gt;run_id = current_run.info.run_id&lt;BR /&gt;&lt;BR /&gt;# Register model&lt;BR /&gt;model_uri = f"runs:/{run_id}/model"&lt;BR /&gt;mlflow.register_model(model_uri, "principal_analysts.nco.iris_model")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;The Key Fix&lt;/STRONG&gt;&lt;BR /&gt;The main issue in your original code was this line:&lt;BR /&gt;run_id = run.info.run_id # 'run' was not defined in this scope&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;They properly capture the run_id within the correct scope where the run object is available.&lt;/P&gt;&lt;P&gt;The error you're seeing suggests that either:&lt;/P&gt;&lt;P&gt;The run variable is not in scope when you try to access run.info.run_id&lt;BR /&gt;The run object is None or doesn't have the expected structure&lt;/P&gt;&lt;P&gt;Try Solution 1 first - it's the most straightforward and should resolve your issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 17:31:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120460#M46171</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-05-28T17:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120520#M46181</link>
      <description>&lt;P&gt;Thank you very much for your response and explanation.&lt;/P&gt;&lt;P&gt;Unfortunately, this takes me back to the original error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried changing the set_tracking_uri to my workspace url and I get the same error.&lt;/P&gt;&lt;P&gt;Any ideas what this could be?&lt;/P&gt;</description>
      <pubDate>Thu, 29 May 2025 08:30:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120520#M46181</guid>
      <dc:creator>NicolaCompton</dc:creator>
      <dc:date>2025-05-29T08:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Error Unable to Register Model to Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120618#M46209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/166099"&gt;@NicolaCompton&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This persistent "Resource temporarily unavailable" error in Databricks with&lt;BR /&gt;Unity Catalog is often related to workspace permissions or configuration issues.&lt;BR /&gt;Let's try several troubleshooting approaches:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 1: Workspace URL Format&lt;/STRONG&gt;&lt;BR /&gt;Make sure you're using the correct workspace URL format:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 2: Check Unity Catalog Permissions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution 3: Minimal Test Setup&lt;/STRONG&gt;&lt;BR /&gt;Try this minimal version to isolate the issue:&lt;/P&gt;&lt;P&gt;import mlflow&lt;BR /&gt;import mlflow.sklearn&lt;BR /&gt;from sklearn.ensemble import RandomForestClassifier&lt;BR /&gt;from sklearn.datasets import load_iris&lt;/P&gt;&lt;P&gt;# Reset MLflow settings&lt;BR /&gt;mlflow.end_run() # End any existing runs&lt;/P&gt;&lt;P&gt;# Minimal configuration&lt;BR /&gt;mlflow.set_tracking_uri("databricks")&lt;/P&gt;&lt;P&gt;# Simple model training and registration&lt;BR /&gt;X, y = load_iris(return_X_y=True)&lt;BR /&gt;clf = RandomForestClassifier(n_estimators=10, max_depth=3)&lt;/P&gt;&lt;P&gt;with mlflow.start_run() as run:&lt;BR /&gt;clf.fit(X, y)&lt;BR /&gt;mlflow.sklearn.log_model(clf, "iris_model")&lt;BR /&gt;run_id = run.info.run_id&lt;BR /&gt;print(f"Run ID: {run_id}")&lt;/P&gt;&lt;P&gt;# Wait a moment for the run to finalize&lt;BR /&gt;import time&lt;BR /&gt;time.sleep(5)&lt;/P&gt;&lt;P&gt;# Try registration with error handling&lt;BR /&gt;try:&lt;BR /&gt;model_uri = f"runs:/{run_id}/iris_model"&lt;BR /&gt;result = mlflow.register_model(&lt;BR /&gt;model_uri=model_uri,&lt;BR /&gt;name="principal_analysts.nco.iris_simple_test"&lt;BR /&gt;)&lt;BR /&gt;print(f"Success! Model version: {result.version}")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Registration failed: {type(e).__name__}: {e}")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "Resource temporarily unavailable" error often indicates either:&lt;BR /&gt;1. Insufficient permissions for Unity Catalog model registration&lt;BR /&gt;2. Workspace configuration issues&lt;BR /&gt;3. Temporary connectivity issues&lt;/P&gt;&lt;P&gt;Try Solution 3 first to isolate the problem, then work backwards to your full implementation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2025 16:03:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-unable-to-register-model-to-unity-catalog/m-p/120618#M46209</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-05-30T16:03:13Z</dc:date>
    </item>
  </channel>
</rss>

