Skip to content

Commit 19bf00d

Browse files
committed
Only import matplotlib where necessary for artifact plotting (mlflow#3703)
* Only import matplotlib where necessary for artifact plotting Signed-off-by: Corey Zumar <corey.zumar@databricks.com> * Silly change for formatter Signed-off-by: Corey Zumar <corey.zumar@databricks.com> Signed-off-by: harupy <17039389+harupy@users.noreply.github.com>
1 parent 6c15b3f commit 19bf00d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mlflow/sklearn/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import inspect
55
import logging
66
from numbers import Number
7-
import matplotlib.pyplot as plt
87
import numpy as np
98
import time
109

@@ -500,6 +499,8 @@ def _log_specialized_estimator_content(fitted_estimator, run_id, fit_args, fit_k
500499
display.ax_.set_title(artifact.title)
501500
filepath = tmp_dir.path("{}.png".format(artifact.name))
502501
display.figure_.savefig(filepath)
502+
import matplotlib.pyplot as plt
503+
503504
plt.close(display.figure_)
504505
except Exception as e: # pylint: disable=broad-except
505506
_log_warning_for_artifacts(artifact.name, artifact.function, e)

0 commit comments

Comments
 (0)