Page 1 of 1

Re: Scientific Python

Posted: Fri Dec 02, 2011 7:03 pm
by CSanders
I haven't seen it mentioned but since I see that Qt is working, it would be great to have at least the option of running scientific packages on the raspberryPi. It might be a little out of the initial scope but would allow the unit to grow a little with kids.

What I'm thinking about would be something along the lines of the following Python Packages (which might require some special rpm's for the linux distro used).

- Numpy
- Scipy
- Matplotlib
- PyTables (Not strictly necessary but very nice)
- Spyder (Not necessary but graphical IDE if desired)

I think some dependencies that you'll need for those include (at least):

- qt4 & qt4-devel
- hdf5
- python's numexpr module
- python's Cython module

What I'm thinking is if my daughter were to be learning on something like this (she's not old enough right now). I would certainly start with a mix of C and Python. Then as she gets the programming part down, expanding the Python lessons to include Matlab-style processing with the scientific packages seems like a logical next step into using the programming for science.

I'd love to see the team at least verify that the base distros for the RaspberryPi can support these even if they aren't pre-installed. I've had little trouble getting these installed but haven't done anything on ARM. The cost of a teacher (I have plenty in my family) setting up 5-6 Scientific Python machines vs the cost of trying to use Matlab would be incredible.

Re: Scientific Python

Posted: Tue Dec 13, 2011 2:38 pm
by andywe
I'm glad you put this thread up ...
I was thinking along similar lines but hoped that someone would put such a thread up ...
I have run advanced Python courses with a scipy bias ..
Scientific Python is used very much in astronomy as well as Geographic Information System(s).
From a teaching point of view a company call TTL (Telescope Technologies Limited), now US owned, but involved with some of the very first robotic telescopes for astronomy, provides access over the web to school wishing to do some serious "astronomical observing" using real telescopes in real observatories, and controlling their exploration over the web ... Night time in Hawaii is daytime in the UK. There are some excellent course materials out there on Python for Astronomers ...

On another point ... as well as hdf5 have you considered netcdf ?
Maybe someone would care to say something about Python and GIS ... ?

Re: Scientific Python

Posted: Fri Jan 06, 2012 10:14 pm
by andywe
'Tis a pity that Scientific Python is perceived as such an "esoteric" subject ...

It is an excellent framework for building all kinds of interesting educational applications ...

From the perspective of Computing and Schools ... it should allow teachers (when not hammered by bureacracy and the "pipe dreams" of ambitious "politicos" ... ) to develop all kinds of interesting applications ...

I would hope that somewhere out there someone is building an intriguing teaching aid that will inspire some to think ... "I could improve on this ... " ....

Combining Scientific Python with Python modules for computer game programming makes all kinds of interesting projects and demonstrations possible ...

Take History combined with Geography ... and e.g. the great London plague ... and a demonstration of how the plague spread ... , or the great fire of London ...

It should also be possible to do some clever "banker bashing" by simulating various stockmarket bubble scenarios demonstrating e.g. that fancy derivatives and computerised trading destabilise financial systems ....

You can drive the Black Scholes equation from Python ...

and, if you combine Python with e.g. OpenFoam (OK admittedly this is a very mathematical tool .. ) you can build some very interesting simulations ...

In the case of Biology / Social Science it is possible to devise some very nice predator-prey models ... and apply these not only to ecosystems but also to banking and capitalist systems ... This raises the quite interesting question as to whether the bankers are the predators or the prey ?

Re: Scientific Python

Posted: Sat Jan 07, 2012 3:32 pm
by mightygoose
i was thinking that with a limited cluster of 4-6 Rpi's could some form of genetic algorithm for sorting the most efficient way for any function to operate be implemented. I mean, they can come up with some pretty mind blowing efficiency savings that the coders themselves aren't sure how or why it works. With limited system capactiy surely that would be a fascinating experiment. Not to say that i know anything at all about its potential implementation or how genetic algorithms even work...

11+12 = 23 (thats my biggest sum yet)

Re: Scientific Python

Posted: Sat Jan 07, 2012 3:37 pm
by liz
Eben says I should tell you he uses sci-py and num-py extensively. We suspect they'll just run out the box - but if they don't, he'll work on a port for fun, because he's a big enthusiast for both.

Re: Scientific Python

Posted: Sat Jan 07, 2012 4:44 pm
by ukscone
I recently picked up an FPGA dev board that i'll be using for emulating some old systems and stumbled across MyHDL http://www.myhdl.org/doku.php which is Python as a hardware description and verification language which can produce verilog and VHDL code. I can't see why it won't run on the Raspi and let me use the Raspi as my dev box for my FPGA board. (of course i'd need to learn python properly )

Re: Scientific Python

Posted: Mon Feb 20, 2012 1:34 am
by hochopeper

liz said:


Eben says I should tell you he uses sci-py and num-py extensively. We suspect they'll just run out the box - but if they don't, he'll work on a port for fun, because he's a big enthusiast for both.


Thanks for this!

ipython, scipy and numpy are probably the first 3 things I'll be trying to install.

Re: Scientific Python

Posted: Mon Feb 20, 2012 11:55 am
by davidmam
Being in a bioinformatics lab where most of the people are eagerly awaiting the Pi, we are starting to look at whether we could build a portable DNA sequencer using the new MinIon USB sequencer.. This would have some technical challenges (scaling from our tens of Gb servers and compute cluster to an efficient, stream based aligner to process the data in real time on a low power device) but should be quite entertaining..

..d

Re: Scientific Python

Posted: Sun May 20, 2012 3:28 pm
by cmatthews
In case anyone is wondering about this I can confirm that Scipy, Numpy and matplotlib all seem to run well on the RPi without any hard work.

Re: Scientific Python

Posted: Thu May 31, 2012 6:34 am
by bjs
Hi,
I'm very interested in this. The combination of the GPIO capabilities of the RPi and the scientific programming of Python, SciPy, Numpy etc. means that you have virtually got a laboratory in a box. That means an enormous opportunity for science teaching at very little cost.

I'm thinking along the same lines as the Phoenix Project or Picolabs but at a more DIY level. Something like using Mechano and none solder matrix boards to build circuits and apparatus. The level could be at any stage from 11years to University level and from my own experience as a scientific consultant the professional level too; you often just want to try something out.

I'm new to python myself so I'm just starting to get going with it on my newly arrived Pi and hoping that the experts will have sorted out GPIO by the time I get there. I've had a long lasting itch to learn how to write my own device drivers; the glue that bonds the experiment to the software. In the past I've been too scared of destroying my box to start messing around with that kind of thing but with the RPi you can't do too much damage other than need to flash a new SD card (interfacing excepted). So I'm thinking why not?

Great work getting numpy and scypy working guys, keep it up!

Re: Scientific Python

Posted: Sat Aug 11, 2012 7:03 pm
by Phisatho
I am keen on installing numpy + scipy + matplotlib.
numpy is already installed.
I have not tried matplotlib yet.
Tried to install scipy. After about six hours of compiling, gcc bailed out reporting internal error.
I have used the git cutting edge version. I am going to give 0.11.0rc1 version a try tonight.

Any help on this will be highly appreciated.

Re: Scientific Python

Posted: Thu Sep 20, 2012 4:27 pm
by kcranley
How did you get on? I would be very grateful if you could give me the commands to load pylab (numpy, scipy & matplotlib) on the Pi.

Re: Scientific Python

Posted: Mon Nov 19, 2012 11:34 am
by cmatthews
Just came back to this post after some time away from the forum.

In Wheezy (2012-10-28), numpy is included already. I found that Scipy and Matplotlib were both available from apt-get and could be installed with the usual command:

Code: Select all

sudo apt-get python-scipy

Code: Select all

sudo apt-get python-matplotlib

Re: Scientific Python

Posted: Sun Nov 25, 2012 5:19 am
by StaticDet5
I'm having a terrible time getting matplotlib to run with my installation of Python. I'm using 3.2. I started out using 2.7 when I was in college a couple of years ago. I haven't used Python that much since then, so I thought I'd "re-learn" the new system.

I've installed matplotlib, but I can't seem to import it while using Python 3.2. I can import it from 2.7.

Is there a way to use matplotlib in 3.2? Has anyone else made the module work in 3.2? (If I know it is possible, that helps). I really just want to automate the generation of a web viewable chart (I'm trying to view a sensor log).

Re: Scientific Python

Posted: Sun Nov 25, 2012 11:44 am
by cmatthews
How did you go about installing matplotlib? If you use apt-get then it will probably only be installed for the default python on the machine which is a 2.x version in Raspbian.

Re: Scientific Python

Posted: Sun Nov 25, 2012 1:36 pm
by yeahbox
StaticDet5 wrote:I've installed matplotlib, but I can't seem to import it while using Python 3.2. I can import it from 2.7.
You need to be a little bit more aware of what versions you are using. As mentioned above, if you used sudo apt-get install python-matplotlib then you get the packages that are matched to the version of python that is default on your system, which is 2.7 in rasbian if I remember correctly. You cannot use a 2.x package in 3.x.

So the quick answer to your question; If you use python 3.x you need numpy and scipy and matplotlib to also be the 3.x packages.

Both scipy and matplotlib both depends on numpy and it is actually just recently (within 1-2 years) that numpy started supporting python 3.x So in this view the matplotlib support for 3.x is also "new".

This is the reason why me and many others who write production code still sticks with 2.x (2.7 in my case) because I am depending on external packages that hasn't been available for 3.x. Now that PyAudio also supports 3.x (thanks Hubert!) I guess that there isn't really anything that forces me to stick with 2.x :)

Re: Scientific Python

Posted: Sun Nov 25, 2012 7:48 pm
by StaticDet5
Took a break, slept a little. Found the problem.

Matplotlib tries to make it easy for you. When you pull down the package, everything is there. Everything is there including BOTH installations (for Python 2.7 and Python 3.2. There may be others, I don't know how to look under the hood).

To install for Python3, you need to run the command:

python3 setup.py install

That "python3" portion is pretty important. Yeah, I know, real beginner mistake, but I didn't see anything about this when I was researching matplotlib for Python3. I read in several places that it was available, and that some folks are having great success with it on the Raspberry Pi.

Thanks for the insight. I'm slowly beginning to wonder if I should have stayed with 2.7. The differences aren't great, so once the project is completed, I may do a port back to 2.7.

Re: Scientific Python

Posted: Sun Nov 25, 2012 11:02 pm
by yeahbox
Python 3.x is the future, so if you get it working in 3.x then stay there. No point in going back to 2.x then. It is just a matter of time before people start migrating to 3.x. The fact that more and more packages comes out with support for 3.x now just makes it easier for people like me to take the step and also "go modern"

Re: Scientific Python

Posted: Mon Feb 18, 2013 5:28 pm
by chuchana
StaticDet5 wrote:To install for Python3, you need to run the command:

python3 setup.py install
Could you tell me where to run it?

Re: Scientific Python

Posted: Mon Feb 18, 2013 10:15 pm
by StaticDet5
I ran it from the command line, in the Home directory:

Code: Select all

sudo python3 setup.py install

Re: Scientific Python

Posted: Wed Feb 20, 2013 1:41 pm
by chuchana
Thank you! Unfortunately, it did not work in my home directory. But before I found this thread and with it how to install it directly, I had started installing stuff via 'pip'. I found the directory pip downloaded the matplotlib source to, and running 'sudo python3 setup.py install' in there seems to be working.