Reputation: 653
Strange behavior in PyCharm (2021.2.1 Professional Edition) with Python 3.9 and numpy 1.21.2. When I run my program with "Run" then it works as expected. But when I run it with "Debug" then the following error messages appears and the program stops:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Python\JobAnalyzer\venv\lib\site-packages\numpy\__init__.py", line 200, in <module>
core.numerictypes.typeDict,
AttributeError: module 'numpy.core' has no attribute 'numerictypes'
python-BaseException
Any hints what could be the cause?
It crashes immediately at the following line:
import matplotlib.pyplot as plt
And in numpy at this line:
# Numpy 1.20.0, 2020-10-19
__deprecated_attrs__["typeDict"] = (
core.numerictypes.typeDict, <--- CRASH HERE
"`np.typeDict` is a deprecated alias for `np.sctypeDict`."
)
Upvotes: 3
Views: 5309
Reputation: 196
The bug is documented here, it is related to PySide2, which is used by default by PyCharm for PyQt compatibility. The workaround (besides downgrading numpy) is to go to PyCharm's settings / "Build, Execution, Deployment" / "Python debugger", and there uncheck or change the value of the PyQt compatibility drop-down to something else than Auto or PySide2:
Upvotes: 8