Skip to content

Commit d31c728

Browse files
authored
Merge pull request #4868 from plotly/psutil-err
Add optional import for psutil
2 parents 366b017 + a3ecf91 commit d31c728

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: packages/python/plotly/plotly/io/_renderers.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@
3535
from plotly import optional_imports
3636

3737
import warnings
38-
import psutil
3938

4039

4140
def display_jupyter_version_warnings():
4241
parent_process = None
4342
try:
44-
parent_process = psutil.Process().parent().cmdline()[-1]
43+
psutil = optional_imports.get_module("psutil")
44+
if psutil is not None:
45+
parent_process = psutil.Process().parent().cmdline()[-1]
4546
except Exception:
4647
pass
4748

0 commit comments

Comments
 (0)