11

I'm trying to install Numpy on my mac so i can practice doing some programming for data science. However i have no idea what i'm doing when it comes to downloading software and btw my knowledge of software instillation in general is terrible (i'm more of a pure mathematician). If it isn't as simple as hit download and it works (as it seemed to do with windows) i'm finding myself getting stuck.

I have python 3.5.1 downloaded on my mac. So the book i'm going through at the moment when talking about arrays starts by saying >>>import numpy, in the command prompt. Thinking it would just be as easy as that i tried it, but obviously it wasn't that simple because i haven't downloaded it. Anyway then i looked into downloading numpy, i downloaded a folder in my downloads called numpy.1.11.0 and copied and pasted it into my desktop. I went back to the idle and typed >>>import numpy again, and again it didn't work.

I'm so confused as to what to do now, i've looked at some older posts but they haven't helped, i've also downloaded an open source package called anaconda (something mentioned in the other posts) which i think has everything (data science related) on it but i have no idea how to use it. Do i create python scripts in anaconda? Do i create the scripts before and some how run them in anaconda?

I'd really appreciate any help regarding how to get numpy installed or perhaps how to start using python in anaconda (or both). I've found myself getting lost in all the jargon in the other posts, a simple step by step approach i.e "first click this", "then install this" would probably be best suited to me, if anyone knows where i can find instructions in this form i'd very much appreciate it.

Thanks for the help!

Edit: Thanks to everyone for the help it has been great, in particular i tried pip3 install numpy in the command line. Now i can import numpy in the python idle. If i want to use it in a script file (i'm using text wrangler for this) would i just import numpy as usual?

In addition i started playing around with anaconda and using the spyder package this also let's me run python scripts and allows me to import numpy.

Pavan Sangha
  • 249
  • 1
  • 3
  • 10
  • For such things I prefer Macports (there are other similar package managers), with that installed it is as simple as calling e.g. `port install numpy` from a command line :) – Bart May 30 '16 at 19:48
  • If you have troubles setting up the scientific python stack, try anaconda. It's a python distribution developed to solve this problem. – cel May 30 '16 at 19:49
  • 2
    1) go to terminal 2) enter `pip3 install numpy` and enter 3) wait for it to install numpy. – Tadhg McDonald-Jensen May 30 '16 at 19:49
  • 1
    Have you tried using PIP? In terminal: `sudo pip install numpy` – tglaria May 30 '16 at 19:50
  • 1
    @tglaria don't use `sudo` unless necessary as a general rule, pip almost never needs it. – Tadhg McDonald-Jensen May 30 '16 at 19:52
  • @TadhgMcDonald-Jensen thanks for comment, I thought it might be needed (haven't really used OS X in a while). – tglaria May 30 '16 at 19:53
  • Python doesn't look at your desktop for packages to import (unless you run python starting at the desktop), you probably needed to copy the files to the python installation folder. Or start the anaconda shell and you should have numpy, otherwise use pip – OneCricketeer May 30 '16 at 19:53
  • If you want a '"first click this", "then install this"' solution, you definitely want something like [**Anaconda**](https://www.continuum.io/downloads). Just click that link and follow the instructions (and pick either Python version, 2.7 or 3.5). The advantage of Anaconda (or similar) is this will give you all the other tools as well, such as `matplotlib`, etc, all very easily. **Don't mess with Homebrew, Macports, etc, if you just want to start working on data science.** – tom10 May 30 '16 at 20:57

1 Answers1

35

Go to your terminal and run the following command:

pip3 install numpy

If that gives you permission or IO errors try using sudo

sudo pip3 install numpy
Tadhg McDonald-Jensen
  • 20,699
  • 5
  • 35
  • 59
Ryan
  • 2,167
  • 2
  • 28
  • 33