7

The version of Python I have working on my computer is Python2.7 (32 bit) even though I have Windows 7 64-bit (Python works fine, no problem there)

--> I downloaded - numpy 1.8.0 from https://pypi.python.org/pypi/numpy but I don't know how to proceed with installation.

--> I tried downloading from here - http://www.lfd.uci.edu/~gohlke/pythonlibs/ (tried with both 32-bit and amd64-bit versions) . However, I kept getting the following error - Python27 not found in the registry.

--> After moving "Python27" from some other location to C:\Python27, the installation ran properly. I'm now trying

import numpy

but I get an error saying module does not exist

Could anyone please guide on how to get this working, as well as installing matplotlib ? If there is a link, please link me to it.

edit - while I was waiting for answers on here (happy to see the replies! I did some tinkering and I've managed to install all the above. I'm attaching a screenshot of the procedures I followed. But while running a test script for MatPlotLib to plot a graph, instead of a figure of the graph, I'm getting this message - [ < matplotlib.lines.Line2D object at 0x05A29650 > ] If someone could help me out , I'd be grateful and if Thank You doesn't suffice, I'll pay you back in Bitcoin ($1 worth)!

steps of installation

edit 2 - Ah, I saved the plot into a variable and then ran pylab.show(variable). Works. Thanks for all the replies!

7 Answers 7

11

It is also worth considering the Anaconda Python distribution.

http://continuum.io/downloads

It bundles many packages, including NumPy and Matplotlib. I use it on Windows and it is easy to install and to maintain. The one downside, as of this writing, is that they haven't uploaded a Windows build of NumPy 1.8. If you need some feature specific to NumPy 1.8, you can use the installer from the website you mentioned, i.e.

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Update: 1.8 has been there for some time now. They are very good about keeping all the packages up to date, but, if you really need something that isn't already there, check the installers on Gohlke's website.

8

Go to your Python directory, scripts folder:

cd c:\python27\scripts>

Enter the following command on command prompt:

c:\python27\scripts>pip install numpy

Internet connection is required during installation.

1
  • Welcome to SO. Please format code using four space for code blocks or backticks for inline code Apr 1, 2016 at 12:05
4

Firstly uninstall Python.

Then there are two easy choices:

Either:

Try a Python distribution bundled with the necessary libraries. I've used the Enthought Python Distribution before which has been renamed to Canopy Express.

Or:

Install Python 2.7 64bit, all the 64 bit libraries you need from http://www.lfd.uci.edu/~gohlke/pythonlibs/ come with an installer.

To get matplotlib running you'll need to download numpy, dateutil, pyparsing, pillow and you many want a different backend for rendering such as wxPython. Check you're downloading the correct versions, they'll end with something like '.win-amd64-py2.7.exe'. Don't worry if you have an Intel processor, it will still work.

2

Numpy:

  1. Download and install Microsoft Visual C++ Compiler for Python 2.7
  2. Download and extract numpy-1.10.1.zip
  3. Open cmd.exe and cd to numpy-1.10.1 root

    python setup.py install
    
1

Probably the easiest thing to do is reinstall Python from python.org, either 32- or 64-bit, make sure that runs smoothly, and then try to reinstall NumPy, matplotlib, and matplotlib's dependencies (dateutil, pytz, pyparsing, six, pillow, and a backend like pyqt4 or pycairo if you don't want to use the default Tk backend), all from Gohlke's site. Make sure you get the "bitness" for the version of Python you install (you shouldn't mix 32-bit modules with a 64-bit base system, and vice versa), and get the -py27 versions. After that everything should be working fine.

1

Matt's answer is correct; however, I would suggest the easiest thing to do is download a prebuilt Python distribution. I've used Winpython (http://winpython.sourceforge.net/) with good success, though there are certainly others (Enthought, Python(x,y)).

If you use Winpython, open its Control Panel, and register your distribution. If you download more packages off PyPI later, that control panel can install them for you, but it's fairly full featured as-distrubted.

1

Same issue here and had to fix multiple times. The best solution I found, keeping your current installation of Python, was...

(1) If you don't already have PIP installed, install with instructions on https://pip.pypa.io/en/latest/installing.html (referenced on python.org site).

(2) Install numpy with unofficial binaries here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy.

update: This link was updated to include PIP "wheel" files (.whl) instead of Windows installation files. Once you download the appropriate wheel (say, file.whl), you install it like this:

pip install "location_of_whl_file\file.whl"

(pointing to the location of the wheel file)

(3) Then install matplotlib with PIP via command pip install matplotlib This will install all dependencies correctly (other than numpy which required the manual installation).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.