Closed
Description
Encountered this error today when calling fig.show()
in a fresh Python environment:
ModuleNotFoundError: No module named 'psutil'
Stack trace:
(local) (plotly.py) (base) ekl@Emilys-MacBook-Air-2 plotly.py % python test-histogram.py
Traceback (most recent call last):
File "/Users/ekl/code/plotly.py/test-histogram.py", line 17, in <module>
fig.show()
File "/Users/ekl/code/plotly.py/packages/python/plotly/plotly/basedatatypes.py", line 3414, in show
return pio.show(self, *args, **kwargs)
^^^^^^^^
File "/Users/ekl/code/plotly.py/packages/python/plotly/_plotly_utils/importers.py", line 36, in __getattr__
class_module = importlib.import_module(rel_module, parent_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.12.5/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/ekl/code/plotly.py/packages/python/plotly/plotly/io/_renderers.py", line 38, in <module>
import psutil
ModuleNotFoundError: No module named 'psutil'
This is caused by the addition of import psutil
at the top of plotly/io/_renderers.py
in #4823.
I think all that needs to change is to move import psutil
inside display_jupyter_version_warnings()
under the two Jupyter elif
cases (so that it doesn't get encountered when calling the normal fig.show()
from a regular Python script).
Metadata
Metadata
Assignees
Labels
No labels