I do exactly the same thing in both macOS terminal and pycharm console:
>>> import matplotlib.pyplot as plt
>>> plt.hist([-94, -89, 88, 55, 45, 44, 43, 42, 1])
2022-05-02 14:04:31.849 Python[2353:66317] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/_0/8cr6pwvs1jg99fgtf2_33lsm0000gn/T/org.python.python.savedState
(array([2., 0., 0., 0., 0., 1., 0., 4., 1., 1.]), array([-94. , -75.8, -57.6, -39.4, -21.2, -3. , 15.2, 33.4, 51.6,
69.8, 88. ]), <BarContainer object of 10 artists>)
>>> plt.show()
import matplotlib.pyplot as plt
plt.hist([-94, -89, 88, 55, 45, 44, 43, 42, 1])
Out[8]:
(array([2., 0., 0., 0., 0., 1., 0., 4., 1., 1.]),
array([-94. , -75.8, -57.6, -39.4, -21.2, -3. , 15.2, 33.4, 51.6,
69.8, 88. ]),
<BarContainer object of 10 artists>)
plt.show()
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/numpy/core/getlimits.py", line 459, in __new__
dtype = numeric.dtype(dtype)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3251, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-9-1eb00ff78cf2>", line 1, in <module>
plt.show()
File "/usr/local/lib/python3.10/site-packages/matplotlib/pyplot.py", line 368, in show
return _backend_mod.show(*args, **kwargs)
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 29, in __call__
manager.show(**kwargs)
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 112, in show
self.canvas.show()
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm_matplotlib_backend/backend_interagg.py", line 68, in show
FigureCanvasAgg.draw(self)
File "/usr/local/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 436, in draw
self.figure.draw(self.renderer)
File "/usr/local/lib/python3.10/site-packages/matplotlib/artist.py", line 73, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/usr/local/lib/python3.10/site-packages/matplotlib/figure.py", line 2810, in draw
mimage._draw_list_compositing_images(
File "/usr/local/lib/python3.10/site-packages/matplotlib/image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File "/usr/local/lib/python3.10/site-packages/matplotlib/artist.py", line 50, in draw_wrapper
return draw(artist, renderer)
File "/usr/local/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3020, in draw
self._unstale_viewLim()
File "/usr/local/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 776, in _unstale_viewLim
self.autoscale_view(**{f"scale{name}": scale
File "/usr/local/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 2932, in autoscale_view
handle_single_axis(
File "/usr/local/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 2895, in handle_single_axis
x0, x1 = locator.nonsingular(x0, x1)
File "/usr/local/lib/python3.10/site-packages/matplotlib/ticker.py", line 1654, in nonsingular
return mtransforms.nonsingular(v0, v1, expander=.05)
File "/usr/local/lib/python3.10/site-packages/matplotlib/transforms.py", line 2880, in nonsingular
if maxabsvalue < (1e6 / tiny) * np.finfo(float).tiny:
File "/usr/local/lib/python3.10/site-packages/numpy/core/getlimits.py", line 462, in __new__
dtype = numeric.dtype(type(dtype))
TypeError: 'NoneType' object is not callable
And both use the same interpreter
paths
Edit
The error only happens when using the debugger, otherwise it works fine.
Most likely an issue in PyCharm in relation to MatplotLib I would raise an issue in the PyCharm issue tracker: https://youtrack.jetbrains.com/issues/PY