Deep end is deep
December 15, 2010 8:22 AM   Subscribe

Help me install numpy (the python numerical computing module) on an Amazon EC2 instance!

My computer fluency: I'm pretty familiar with Ubuntu, but I haven't spent much time on other distros.

I've been doing some computing with python, and I decided to get some more speed I would try using Amazon's EC2 service. So, I started up an EC2 instance using their Amazon-flavored linux 32-bit high-CPU option.

As I expected, numpy was not installed (my python code requires the numpy module). I tried following the directions here, using DavidCournapeau's repo file for RHEL (picked that flavor at random - should I try a different one?), and used
sudo yum install python-numpy
That seemed to work, so I tried importing numpy in python. No dice - python couldn't find the package. Maybe I have to do something with the python path variable?! I got discouraged and removed python-numpy.

Then I tried downloading the tar.gz file from the sourceforge link at (here). I un-archived it, and tried to run
python install
But that failed with this error:
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
I have no idea where to find python-dev or python-devel, and am a bit discouraged anyhow.

Does anyone have any experience with this, or ideas on what to try to get numpy working?
posted by Salvor Hardin to Computers & Internet (9 answers total)
Best answer: Have you tried:

sudo yum -y install python-devel
sudo yum -y install python-dev

posted by Blazecock Pileon at 8:45 AM on December 15, 2010

Response by poster: Thank you!!! Awesome - that gets me part of the way there. After successfully running
sudo yum -y install python-devel
I ran
sudo python install
Which seemed to complete successfully.

But now there's a new problem. When I try to import numpy in the python interpreter, python throws this error:
>> ImportError: No module named multiarray
Which should be part of the numpy module, I guess. Any further ideas? Thanks so much for the help!
posted by Salvor Hardin at 9:11 AM on December 15, 2010

Best answer: What happens if you add import numpy.core.multiarray to a test Python script?
posted by Blazecock Pileon at 9:14 AM on December 15, 2010

Response by poster: I get an identical error - "No module named multiarray"

Thanks again for the help so far.
posted by Salvor Hardin at 9:17 AM on December 15, 2010

Also, you might try getting the latest numpy from Sourceforge, which is 1.5.1. The version on David Cournapeau's site is 1.2, it looks like.
posted by Blazecock Pileon at 9:20 AM on December 15, 2010

Response by poster: Wait, this is weird. It started working. Everything works now. I have numpy! Hooray for BP!!! THANK YOU!
posted by Salvor Hardin at 9:21 AM on December 15, 2010

Awesome, glad to help.
posted by Blazecock Pileon at 9:25 AM on December 15, 2010

For future reference, you're more than welcome on the numpy-discussion and scipy-user mailing lists! They are awesome and full of extremely knowledgeable people.
posted by dorque at 1:26 PM on December 15, 2010

Its possible you needed to log back out / back in (or restart the python interpreter?)
posted by pwnguin at 4:02 PM on December 15, 2010

« Older Gift for 6-year-old with Asperger's   |   Need your creative juice for filling a toy vending... Newer »
This thread is closed to new comments.