Cannot import NumPy module in PyCharm (but it runs fine in the terminal window on Mac) and I keep receiving the below import error:
Traceback (most recent call last): File "/Users/ishanp/PycharmProjects/APIcreation/API.py", line 1, in <module> import pandas as pd File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pandas/__init__.py", line 16, in <module> raise ImportError( ImportError: Unable to import required dependencies: numpy: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.
请先登录再写评论。
Please copy the command from the first line of the error output and run it in the system terminal, take a screenshot, and post it here.
If it produces no error, please also open Run | Edit Configurations, find the run configuration for your Python script, take a screenshot, and post it in the thread as well.
Its showing the same error to me as well. When importing pandas its showing the import error for numpy it was working perfectly fine some time back but now its throwing this error
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
thats the error it shows
The error for me was resolved I simply uninstalled and reinstalled numpy thats what worked for me
Hi, I have encountered exactly the same error. Have tried reinstalling numpy but still no luck. Could you help advise please
Hi there - thanks for coming back
I have used both terminal to install and install package in Python interpreter. Tried uninstall and install again but no luck
I've uninstalled & installed using pip as well as the IDE. They same behavior. It works from the command line python3 but not IDE. The IDE generates the error above. Something so sophisticated is somehow tripped.
Please advise … yes, rebooted too.
This worked for me:
pip3 freeze | sort > requirements.txt
pip3 uninstall -r requirements.txt
arch -arm64 pip3 install -r requirements.txt