So I have been having some trouble with this. I need to use numpy so that I can use OpenCV and so I installed Miniconda (Not Miniconda3 because we are working in Python 2.7) and I installed numpy with conda install numpy
and it worked because when I run conda list
I see that it is there:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\joe30_000>conda list
# packages in environment at C:\Users\joe30_000\Miniconda:
#
conda 3.17.0 py27_0
conda-env 2.4.2 py27_0
menuinst 1.0.4 py27_0
numpy 1.9.3 py27_0
pip 7.1.2 py27_0
pycosat 0.6.1 py27_0
pycrypto 2.6.1 py27_3
python 2.7.10 0
pyyaml 3.11 py27_2
requests 2.7.0 py27_0
setuptools 18.3.2 py27_0
wheel 0.26.0 py27_1
C:\Users\joe30_000>
And as you can see it is installed for Python 2.7. However, when I go to the python command line and try import numpy
I get the error that no module exists:
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>>
Why is this happening? Do I have to somehow sync Conda with Python so that Python is using the modules that Miniconda has installed?
The Python "ModuleNotFoundError: No module named 'numpy'" occurs when we forget to install the numpy module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install numpy command.
There are two ways to install numpy: Install the binary (pre-compiled) version using pip. Compile it from source code, and then install it.
If you installed the Anaconda distribution of Python, NumPy comes pre-installed and no further installation steps are necessary. If you use a version of Python from python.org or a version of Python that came with your operating system, the Anaconda Prompt and conda or pip can be used to install NumPy.
So thanks to @Bubbafat, I found the solution and I want to post it in case anyone else has problems. Like Bubbafat said, conda has its own version of the Python interpreter. It is located in the Miniconda directory (It's called "Python.exe"). If you are using an IDE you need to switch the interpreter to use this version of Python rather than the default one you may have installed on the internet from the Python website itself. I hope this was helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With