ImportError: No module named numpy
ImportError: No module named numpy
$ python -c "import numpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
Why this happens
NumPy isn’t installed in the active Python environment, or you’re using a different interpreter/virtualenv than expected.
Fix
Install NumPy in the active environment (pip, conda) or activate the correct virtual environment/interpreter.
Wrong code / state
# No numpy installed in environment
python -c "import numpy"
Fixed (install)
pip install numpy
# or with conda
conda install numpy