I'm trying to install numpy
My steps are as follows:
Open cmd in numpy extracted folder(where I had extracted .tar.gz file)
Then python setup.py install
But I'm getting an error as follows:
with many warnings like this and at the end error unable to find vcvarsall.bat
(I regret to put a photo but I couldn't find any better way to copy text from cmd window)
if possible suggest a compiled setup of numpy
-
windows 32 bit or 64 bit?(edit - nevermind. I'll post an answer with details.)– KobeJohnDec 13, 2013 at 13:18
-
1Do yourself a massive favour and install the pre-compiled NumPy stack from here: continuum.io/downloads– YXDDec 13, 2013 at 13:37
-
Yes do what Mr. E says. Unless you need to have your own vanilla setup and then do the stuff in my answer below.– KobeJohnDec 13, 2013 at 13:56
5 Answers
Edit: Apparently this answer still gets attention occasionally. For anybody needing numpy, you almost certainly will be happier and more productive if you just go and get conda or miniconda which make installing all kinds of libraries like numpy very easy. In fact the first example on the page is conda install numpy
. An additional bonus: I find that conda works better as a package manager than virtualenv.
Summary: Just use anaconda
There is a discussion on this on stackoverflow but I can't find it. It's easy once you know how to do it, but not obvious. The key is to use the premade binaries instead of compiling it yourself + easy_install. Unless you want to compile it yourself and that's a whole different answer.
Either installing to virtualenv or just to your main python, here is what I do:
Download the latest numpy installer for windows and your version of python here.
Open that file in 7zip or whatever you have. Extract the installer that works for your CPU. Probably SSE3.
Put that file somewhere and get the full path to it including the name of the file.
From your command line with/without virtualenv activated, type:
easy_install "..."
with the quotes and with your full path pasted in place of ...(extra step) you may need to add
C:\python27\Scripts\
to your system path (using your actual python path) if you get an error that easy_install is not found.
That should do it. If you want to compile it yourself (if the message you posted lost you, then you probably don't), then you'll need to read up on getting a c compiler installed and setup in windows for python.
-
Neither do I. Well, I would like to compile myself to optimize things with numpy and opencv (that's what I use numpy for) but the default python install doesn't include a compiler setup for it so I don't :)– KobeJohnDec 13, 2013 at 13:29
-
Just to be clear, the instructions I put are exactly how to do it without needing to compile. (edit - yes. easy_install is the only thing I know that will handle a binary installer for virtualenv or vanilla if you're not using it. That's the magic of this method.) The installer may work on its own if you want to try it.– KobeJohnDec 13, 2013 at 13:30
-
by installer you mean .exe file eg. I have python2.7 so I would download numpy-1.8.0-win32-superpack-python2.7.exe ???? Dec 13, 2013 at 13:32
-
yes that's right. And then extract one of the installers from inside of that (it's actually just an executable compressed file).– KobeJohnDec 13, 2013 at 13:33
-
easy_install is not recognized as an internal or external command Dec 13, 2013 at 13:40
You should be able to use the installers available here without any issues: https://sourceforge.net/projects/numpy/files/NumPy/1.8.0/
Make sure to pick the appropriate executable for your Python version.
If you are running Python 2.7 use the one linked here.
Note for future readers: If any updates to NumPy have been released, you might want to go here and choose the latest version available.
This is because numpy needs to compile binaries. You can get the binaries from here.
I had this same issue trying to install numpy 1.9.2 for python 3.4 (most recent version at 02/04/2015)
I manged to fix this by downloading the .exe from http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/numpy-1.9.2-win32-superpack-python3.4.exe/download
and now I can use Numpy in pycharm
Hope this helps!
For Python 3 users
I am using Python 3.8.5 on Windows 10, I was able to install Numpy 1.20.2 (most recent as of Apr 1 2021) without any issues along with Pandas 1.2.3, Six 1.15.0, python-dateutil 2.8.1 using pip 21.0.1
So, upgrade to latest pip and try again ^_^
P.S. Not an April Fool's Joke