Installing NumPy and SciPy on 64-bit Windows (with Pip) - python

I found out that it's impossible to install NumPy/SciPy via installers on Windows 64-bit, that's only possible on 32-bit. Because I need more memory than a 32-bit installation gives me, I need the 64-bit version of everything.
I tried to install everything via Pip and most things worked. But when I came to SciPy, it complained about missing a Fortran compiler. So I installed Fortran via MinGW/MSYS. But you can't install SciPy right away after that, you need to reinstall NumPy. So I tried that, but now it doesn't work anymore via Pip nor via easy_install. Both give these errors:
There are a lot of errors about LNK2019 and LNK1120,.
I get a lot of errors in the range of C: C2065,C2054,C2085,C2143`, etc. They belong together I believe.
There is no Fortran linker found, but I have no idea how to install that, can't find anything on it.
And many more errors which are already out of the visible part of my cmd-windows...
The fatal error is about LNK1120:
build\lib.win-amd64-2.7\numpy\linalg\lapack_lite.pyd : fatal error LNK1120: 7 unresolved externals
error: Setup script exited with error: Command "C:\Users\me\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\BLAS /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-2.7 lapack.lib blas.lib /EXPORT:initlapack_lite build\temp.win-amd64-2.7\Release\numpy\linalg\lapack_litemodule.obj /OUT:build\lib.win-amd64-2.7\numpy\linalg\lapack_lite.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\numpy\linalg\lapack_lite.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\numpy\linalg\lapack_lite.pyd.manifest" failed with exit status 1120
What is the correct way to install the 64-bit versions NumPy and SciPy on a 64-bit Windows machine? Did I miss anything? Do I need to specify something somewhere? There is no information for Windows on these problems that I can find, only for Linux or Mac OS X, but they don't help me as I can't use their commands.

You can install scipy and numpy using their wheels.
First install wheel package if it's already not there...
pip install wheel
Just select the package you want from http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Example: if you're running python3.5 32 bit on Windows choose scipy-0.18.1-cp35-cp35m-win_amd64.whl then it will automatically download.
Then go to the command line and change the directory to the downloads folder and install the above wheel using pip.
Example:
cd C:\Users\[user]\Downloads
pip install scipy-0.18.1-cp35-cp35m-win_amd64.whl

EDIT: The Numpy project now provides pre-compiled packages in the wheel format (package format enabling compiled code as binary in packages), so the installation is now as easy as with other packages.
Numpy (as also some other packages like Scipy, Pandas etc.) includes lot's of C-, Cython, and Fortran code that needs to be compiled properly, before you can use it. This is, btw, also the reason why these Python-packages provide such fast Linear Algebra.
To get precompiled packages for Windows, have a look at Gohlke's Unofficial Windows Binaries or use a distribution like Winpython (just works) or Anaconda (more complex) which provide an entire preconfigured environment with lots of packages from the scientific python stack.

Installing with pip
You can install the numpy and scipy wheels on Windows with pip in one step if you use the appropriate link from Gohlke's Unofficial Windows Binaries (mentioned by sebix) and run the Windows command prompt as Administrator. For example, in Python 3.5, you would simply use something like this:
# numpy-1.9.3+mkl for Python 3.5 on Win AMD64
pip3.5 install http://www.lfd.uci.edu/~gohlke/pythonlibs/xmshzit7/numpy-1.9.3+mkl-cp35-none-win_amd64.whl
# scipy-0.16.1 for Python 3.5 on Win AMD64
pip3.5 install http://www.lfd.uci.edu/~gohlke/pythonlibs/xmshzit7/scipy-0.16.1-cp35-none-win_amd64.whl

Best solution for this is to download and install VCforPython2.7 from https://www.microsoft.com/en-us/download/details.aspx?id=44266
Then try pip install numpy

Downloading the binaries for 64-bit from http://www.lfd.uci.edu/~gohlke/pythonlibs/, and installing it directly with pip in this order:
pip install numpy-1.12.0+mkl-cp36-cp36m-win64.whl
pip install scipy-0.18.1-cp36-cp36m-win64.whl
pip install matplotlib-2.0.0-cp36-cp36m-win64.whl
Note that you must place command prompt in the folder where you put the .whl files after downloading them, and you must run it as administrator,
worked for me on Windows 10 64-bit now python is up and running.

You can now pip install numpy on Windows!
"Note: this page has only historical relevance, you can now pip-install for windows"
Source: https://github.com/numpy/numpy/wiki/Whats-with-Windows-builds

Intel provides pre-compiled Python modules for free in their "Intel Distribution for Python". The modules are compiled against Intel's MKL (Math Kernel Library) and thus optimized for faster performance. The package includes NumPy, SciPy, scikit-learn, pandas, matplotlib, Numba, tbb, pyDAAL, Jupyter, and others. Find more information and the download link here

If you are on windows , you wouldn't need wheel anyway! You can directly install package by downloading the 32-bit package as win32 from this link [http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy] and then move that downloaded package to cmd's current directory and open cmd and write following codepip install numpy-1.13.1+mkl-cp36-cp36m-win32.whl then do it same for scipy
For 64-bit you need to install mingw-w64 as it is gcc and compiles numpy and scipy as precompiled status.
Currently it works fine with 32-bit.So I had opted for win32 package both for numpy+mkl and scipy in that link.
Hope This works! Give a try

You can download the needed packages from here and use pip install "Abc.whl" from the directory where you have downloaded the file.

Look into python wheels to solve your problem. The best part of python wheels is that they let you install C extensions with no compilers. I just installed numpy and scipy using pip in a clean python install and they both worked fine.

for python 3.6, the following worked for me
launch cmd.exe as administrator
pip install numpy-1.13.0+mkl-cp36-cp36m-win32
pip install scipy-0.19.1-cp36-cp36m-win32

Package version are very important.
I found some stable combination that works on my Windows10 64 bit machine:
pip install numpy-1.12.0+mkl-cp36-cp36m-win64.whl
pip install scipy-0.18.1-cp36-cp36m-win64.whl
pip install matplotlib-2.0.0-cp36-cp36m-win64.whl
Source.

Hey I had the same issue.
You can find all the packages in the link below:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn
And choose the package you need for your version of windows and python.
You have to download the file with whl extension. After that, you will copy the file into your python directory then run the following command:
py -3.6 -m pip install matplotlib-2.1.0-cp36-cp36m-win_amd64.whl
Here is an example when I wanted to install matplolib for my python 3.6 https://www.youtube.com/watch?v=MzV4N4XUvYc
and this is the video I followed.

Follow these steps:
Open CMD as administrator
Enter this command : cd..
cd..
cd Program Files\Python38\Scripts
Download the package you want and put it in Python38\Scripts folder.
pip install packagename.whl
Done
You can write your python version instead of "38"

Related

How to instal scipy package on windows?

I downloaded the scipy package as wheel, the last version for windows 64 bits scipy-0.18.1-cp36-cp36m-win32
when i use
pip install scipy-0.18.1-cp36-cp36m-win64.whl
this command display
numpy-1.12.0b1+mkl-cp36-cp36m-win64.whl is not a supported wheel on this platform.
what is the problem?
1) To get precompiled packages for Windows, have a look at Gohlke's Unofficial Windows Binaries or use a distribution like Winpython (just works) or Anaconda (more complex) which provide an entire preconfigured environment with lots of packages from the scientific python stack.
2) Installing with pip
You can install the numpy and scipy wheels on Windows with pip in one step if you use the appropriate link from Gohlke's Unofficial Windows Binaries (mentioned by sebix) and run the Windows command prompt as Administrator. For example, in Python 3.5, you would simply use something like this:
# numpy-1.9.3+mkl for Python 3.5 on Win AMD64
pip3.5 install http://www.lfd.uci.edu/~gohlke/pythonlibs/xmshzit7/numpy-1.9.3+mkl-cp35-none-win_amd64.whl
# scipy-0.16.1 for Python 3.5 on Win AMD64
pip3.5 install http://www.lfd.uci.edu/~gohlke/pythonlibs/xmshzit7/scipy-0.16.1-cp35-none-win_amd64.whl
or you can look here -> https://www.scipy.org/install.html
If all else fails, try using Python(x,y) - a scientific distribution of Python which comes with scipy bundled.

How to install numpy+mkl for python 2.7 on windows 64 bit?

I've already installed numpy 1.9.0 in Python.Now what should I do to get numpy+mkl?
If you do not have an entire Python distribution or you do not want to install one, you can download and install a compiled whl package from Christoph Gohlke's webpage. This whl contains numpy and is linked against mkl. When installing this package, you install both: numpy with the mkl dependencies.
All you have to do is:
download the correct whl file (Choose the right Python version and 32/64 file)
open a Windows cli with Windows+R and by running inside cmd
go to the directory where you have downloaded the whl file, with cd instructions
run pip install numpy‑1.XX.Y+mkl‑cp3X‑cp3Xm‑win_amd64.whl
For example, the command can be
pip install numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
You can do it for any package with some code that has to be compiled
The easiest way is to install an entire Python distribution with lots of included packages, such as numpy and mkl. I would suggest the Anaconda Python distribution, https://www.continuum.io/downloads
The above answer does great (+1) and brought me on the right track, but to
clear things up even more:
You can download the .whl from here
For choosing the right .whl you need to know numpy‑1.11.3+mkl‑cpXX‑cpXXm‑win_amd64.whl
where the XX are actually your python version (e.g. 36 for python version 3.6.x)
Do pip install numpy‑1.11.3+mkl‑cp**XX**‑cp**XX**m‑win_amd64.whl in your cmd window and the place where you did download the .whl into

Trouble installing scipy despite having python2.7 and numpy installed already

I'm having trouble installing scipy via the binaries provided at http://sourceforge.net/projects/scipy/files/scipy/
Double clicking on the mpkg file after mounting the dmg installer gives the following error:
"scipy 0.13.0 can't be installed on this disk. scipy requires System Python 2.7 to install"
However, I already have python 2.7 and numpy installed. The python 2.7 came default with OSX Lion, so I assume it is System Python. With other python modules, one normally can download the binary then run
python setup.py install
Is there a way to cd through the mpkg file and locate a setup.py? Any advice install via this dmg installer?
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages (for example, it will try to reinstall python and numpy via port)
Thanks!
If you have Mavericks and XCode 5, then you'll have to install Command Line Tools manually from the Apple Developer Site. I found this helpful post
You've got a few misconceptions here.
With other python modules, one normally can download the binary then run python setup.py install
No, that's what you do with source packages.
Is there a way to cd through the mpkg file and locate a setup.py?
No. What's inside an mpkg are pkg files. Which are filled with xar archives filled with cpio archives. Inside there is the built version of SciPy—that is, the files that setup.py would have copied to your site-packages if you'd run it—not the source package.
But you can download the source package yourself.
Or, better, let pip (or easy_install, but pip is better) download and run the setup.py for you.
Any advice install via this dmg installer?
If it won't work, my advice would be to not use it, and instead install with pip.
This blog post explains it, but I'll give you the details relevant to you below.
I know there are other ways to manage python modules, like port and brew. However, I already installed a bunch of packages through setup.py, and I couldn't figure out how to get port to recognize those packages.
You can't. MacPorts will not touch your system Python; it builds its own separate Python 2.7, with a completely independent site-packages directory and everything else. You would have to reinstall everything for this second Python 2.7. And deal with the confusion of having two Python 2.7 installations on the same machine.
Don't do that unless you absolutely have to.
In fact, if you want to use Homebrew for anything (and you do, see below), uninstall MacPorts, unless you really need it for something.
So, here are the steps:
Uninstall MacPorts.
I assume you already have Xcode and its Command Line Tools.
I assume you already have Homebrew.
Install a Fortran compiler with brew install gfortran.
Lion's Python 2.7 comes with easy_install, but not pip. So sudo easy_install pip to fix that. While you're at it, I'd suggest sudo easy_install readline, because you'll want that for ipython, and it won't work right with pip.
Apple's pre-installed NumPy has to be upgraded, and rebuilt with Fortran support, to make SciPy work. Fix that with sudo pip install --upgrade --force-reinstall numpy.
If you want ipython, pandas, etc. sudo pip install each of them as well.
In case you're considering upgrading soon, the exact same steps worked for me with OS X 10.9.0, except for some extra work to get the Xcode 5 command line tools set up.

I am trying to import numpy for use in a Python script but I get the error "No module named numpy"

I am using MinGW on a 64-bit Windows machine. I am using Python 2.6.8. When I try to install numpy from http://sourceforge.net/projects/numpy/files/NumPy/ , the error comes up that it cannot find Python2.6 in the registry. Please walk me through what I should do.
Do you have pip installed? That would generally be the best way to install it.
With pip
If you don't have pip, do the following:
Run curl http://python-distribute.org/distribute_setup.py | python. This provides you with tools you'll need to install the package manager.
Run curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python. This installs the package manager.
Then run pip install numpy, and it should install for you.
If that doesn't work
Sometimes on Windows machines, installing more complex Python packages throws errors like Unable to find vcvarsall.bat or gcc exited with status code 1 or something along those lines, which are compilation errors. You can get around that by installing unofficial pre-compiled binaries, by running
easy_install http://www.lfd.uci.edu/~gohlke/pythonlibs/2kgjgnai/numpy-MKL-1.6.2.win-amd64-py2.6.exe
That installs a pre-compiled optimized binary of Numpy. This isn't as perfect as installing it straight from the index, and sometimes there can be minor incompatibilities, but it should be fine for most purposes.
After this is completed, you should be able to import numpy without issue.

Trouble installing SciPy on windows

I have Python 2.7 and NumPy installed. I have downloaded pre-built binaries for SciPy, but the install script fails with this error:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
I really don't know enough about this to fool with it. I assumed it was a straightforward install process, but doesn't appear to be. I googled for the BLAS environment variable, but couldn't find anything that seemed appropriate. Any help is appreciated.
Mike
EDIT: Nevermind, I found an unofficial installer exe.
Try installing using Scipy wheel file. Download it from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Make sure to download the one that's compatible with your Python version and your laptop bit. Then install it like this: pip install "path\to\your\wheel\file\scipy-0.18.1-cp27-cp27m-win_amd64.whl"
To install SciPy on Windows you have to have a fortran compiler installed. The SciPy project recommends MinGW. See Building and installing SciPy. To install MinGW follow these instructions: HOWTO Install the MinGW (GCC) Compiler Suite. Then before you run pip or easy_install to install SciPy make sure that you have MinGW added to your path. See MinGW Installation Notes - Environmental Variables
A side note, It would be easier to use either the Enthought Distribution (part of the initial install) or the Active State Distribution (through pypm 32-bit only) as they already have precomiled binary packages for SciPy. Or, you could use the SciPy precompiled binary package installer for Windows.
Here I am going to share what I have done to install scipy.
MY PC Configuration is windows-7 64-bit & python 2.7
First I download the required packages form http://www.lfd.uci.edu/~gohlke/pythonlibs/ (which version match your configuration EX: cp27==>python2.7 & cp36==>3.6)
Second I extract the file using 7zip (also can be used any zipper like winrar)
Third I copy the scipy folder which I extracted and paste it into C:\Python27\Lib\site-packages (or put it where the exact location is in your PC like ..\..\Lib\site-packages)
NOTE: Have to install numpy first before installing scipy in this same way.
To install Scipy on Windows requires a C compiler and the presence of 3rd party C libraries on the system which are difficult to install on Windows. However you can use a Wheel (.whl) file through your command prompt to install Scipy.
I faced the same problem and this is what I did:
Go to https://pypi.python.org/pypi/scipy and download the version of Scipy which is compatible with your system and the Python version you have installed
e.g If you have 32-Bit Windows and Python 3.6 installed then you download the version with cp36 (version3.6) and Win-32.
After downloading copy this file in the directory where you have installed Python either in the Scripts or Lib folder.
Next use the command prompt to install it after changing to the directory where you have copied the file:
C:\....> pip install scipy-1.0.0b1-cp36-cp36m-win32.whl
Steps to download scipy on Windows-
1.Go to website sourceforge.net
2.Click Files
3.Downlaod the type you want
4.Install it.
Very easy and it worked for me.

Categories