I am using Python 3.4.0. I am going to assume that the numpy module should work, as this is one of the newer versions of python. However, anything I do with numpy will result in a syntax error. Forexample this code here:
import numpy
list1=[1,3,2,6,9]
list2=numpy.mean(list1)
print(list2)
And then I get:
Traceback (most recent call last):
File "/home/yichen/Desktop/python/numpy test.py", line 1, in <module>
import numpy
ImportError: No module named 'numpy'
Is this just a problem with my computer or what?
It looks like numpy is not installed on your system. Assuming that you have the pip script installed with your python, you can perform following command to install it:
pip install numpy
or
pip3.4 install numpy
Or, depending on your distribution, it might come as a package named like python-numpy with your package manager.
Related
!python3.6 abc.py
I am trying to execute the above line of code in google collab.
abc.py contains modules imported like NumPy, sklearn. Recently, I am getting this error in collab :
Traceback (most recent call last):
File "abc.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
This error had never occurred on my previous usages of this code. Please help.
install the packages listed in your file using
pip install <package_name>
safe to install them in virtual environment.
Make sure you have activated virtual environment if you are using one already.
you can use conda install numpy
I have a newly installed Anaconda and tried to run an old code that uses scipy, numpy and os using Spyder 3.2.6. and get an error. When trying to import numpy from the IPythoin console I get
import numpy as np
Traceback (most recent call last):
File "<ipython-input-4-0aa0b027fcb6>", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
The os module however does get imported and works. I tried running python importing both scipy and numpy and I don't have any issue. I'm running just one Anaconda environment, so there's no mistake there.
Assuming you're using Anaconda Prompt:
Try installing Spyder into that environment via "conda install spyder", and then run spyder from that environment via "spyder".
I had the same issue. I just wrote this line in Anaconda Prompt instead of OS command prompt:
pip install <module>
It's obvious that <module> will be replaced by the desired module name.
I am trying to test scikit-learn library, but didn't manage to install it.
More details : I did install numpy, scipy, matplotlib and I can use them just fine. However, when I use pip (pip install -U scikit-learn), I get this error :
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\...\scikit-learn\setup.py", setup_package()
File "C:\Users\...\scikit-learn\setup.py", from numpy.distutils.core import setup
ImportError: No module named 'numpy'
I couldn't find anything about this.
I tried installing scikit-learn directly by using python setup.py and had the same problem. Any ideas?
Thanks you.
I think there are something wrong with the installation of numpy.
Try download and reinstall following package (for Python 2.7):
http://downloads.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python2.7.exe?r=&ts=1442420256&use_mirror=netix
I have installed (with lots of troubles) scikits.audiolab for making sounds out of data. Now when I type:
import scikits.audiolab I get the following error
>>> import scikits.audiolab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/__init__.py", line 25, in <module>
from pysndfile import formatinfo, sndfile
File "/Library/Python/2.7/site-packages/scikits.audiolab-0.11.0-py2.7-macosx-10.7-intel.egg/scikits/audiolab/pysndfile/__init__.py", line 1, in <module>
from _sndfile import Sndfile, Format, available_file_formats, \
File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (/private/tmp/easy_install-gKE3i5/scikits.audiolab-0.11.0/scikits/audiolab/pysndfile/_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object
How do I fix this?
Any alternative package that can do the job?
I had the same issue and for me it was caused by installing another (more recent) version of NumPy.
Check if you have different versions of NumPy installed and try switching back to an older one. For my part: I had a system-wide installation of Python and common modules like NumPy, which I couldn't touch because I'm not admin on that system. So when I installed some other library locally (in ~/.local/lib/python2.7/) it would also install more recent versions of SciPy and NumPy and put them into that local folder. And when importing the module it would draw from the local directory first before looking at the system-wide libraries which were working fine before with scikits.audiolab. So for me it was solved by
pip uninstall numy && pip uninstall scipy because that only deleted the newer local versions of numpy.
But more specific to your case, here is a tutorial how (on a Mac) to switch to a certain version of NumPy:
multiple numpy version on Mac OS X
The NumPy version I found working for my scikits.audiolab is 1.6.1
>>> import numpy
>>> numpy.version.version
'1.6.1'
Hope that helps. :)
Maybe you installed/upgraded numpy after installing talkbox. Try running this command:
pip install --upgrade --force-reinstall scikits.talkbox
As suggested here:
https://github.com/ppwwyyxx/speaker-recognition/issues/13
I've looked at all the other questions like this and they all seem to be a slight variation of this one in which I can't extract an answer for my problem.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
So I installed it with homebrew into the site-packages directory. At this point in time, importing numpy worked. But then when I had trouble downloading matplotlib, I downloaded the original python 2.7 as opposed to the one that comes on Mac. Now I can't import the module unless I' in the numpy directory, and when I try to build matplotlib it can't find numpy (which is a dependency). Any ideas on what could be wrong?
Third-party add-ons ("distributions") to Python, like numpy, are installed to a particular instance of Python. On OS X 10.8 (Mountain Lion), the Apple-supplied Python 2.7 comes with a version of numpy pre-installed. You can access that python with:
/usr/bin/python2.7
I'm not sure what you mean by "downloaded the original python2.7", but if you installed another version of python, you would need to install another version of numpy using it.
If Your Numpy not install during python 2.7 installation so you can download numpy and install easly from this link install link