Python Web Hosting: Numpy, Matplotlib, Scientific Computing

I write scientific software in Numpy / Scipy / Matplotlib. Having developed applications on my home computer, I am now interested in writing simple web applications. Example: a user uploads an image or audio file, my program processes it using Numpy / Scipy, and the output is displayed in the browser using Matplotlib, or maybe the user can download the processed file.

I already paid for a hosting that has Python 2.4.3 installed but no Numpy / Scipy. I also do not have shell access through the command line. Just drag and drop FTP. Pretty limited, but I can get simple Python / CGI scripts.

Surprisingly, web search showed several suitable options for web hosting with such already built-in capabilities. (Please guide me if I'm wrong.) I learn about the Google App Engine, but I still do not have a complete understanding of its tools and limitations. What the network will tell me is that others have similar problems.

Hoping for solutions, I thought I was asking these simple questions to the amazing SO community:

  • Is there an easy way to install numpy (or any third-party package / library) into my already allocated space? I know the Python path in my allocated space, and I know the appropriate Python / Numpy directories on my home computer. Can I just copy the files and make them work? Both local and remote systems run Ubuntu.

  • What hosting sites exist (free or paid) that have Numpy / Matplotlib installed or, if not installed, the ability to install it? Are there any documented sites that you can link to working applications, no matter how simple they are?

  • Can the Google App Engine help me? Or is it completely for something else? Do you use it or others to write scientific applications in Python / Numpy? If so, can you refer to them?

Thank you for your help.

EDIT: after the helpful answers below, I bought a $ 20 plan on Slicehost and I really like it! (I tried Amazon EC2 first. It must have been dumb, but I just couldn't get it to work.) Setting up a Ubuntu server with Apache took only a few hours (and I'm new to Apache). This allows me to do exactly what I wanted with Python and more. I now have my own remote repository for version control. Thanks again!

EDIT 2: Almost two years later I tried Linode and EC2 (again). The linoid is excellent. This time, EC2 seemed simpler - maybe it’s just an added experience, or maybe the improvements that Amazon made to the AWS management console. For those interested in Numpy / Scipy / Matplotlib / Audiolab, here is my Ubuntu cheat sheet whenever I launch an EC2 instance:

ec2:~$ sudo aptitude install build-essential python-scipy ipython python-matplotlib python-dev python-setuptools libsndfile-dev libasound2-dev mysql-server python-mysqldb Upload scikits.audiolab-0.11.0 ec2:~/scikits.audiolab-0.11.0$ sudo python setup.py install ec2:~$ sudo rm -rf scikits.audiolab-0.11.0 ec2:~$ nano .ipython/ipy_user_conf.py ip.ex('import matplotlib; matplotlib.use("Agg"); import scipy, pylab, scipy.signal as sig, scipy.linalg as lin, scipy.sparse as spar, os, sys, MySQLdb, boto; from scikits import audiolab') import ipy_greedycompleter import ipy_autoreload 
+42
python numpy scipy matplotlib
Jan 17 '10 at 5:51
source share
4 answers

1: installing third-party packages in hosted spaces

You really can install third-party packages in your hosted space. If this is a pure python package, all you need to do is unzip it into a directory and then add this directory to the PYTHONPATH or sys.path environment variable.

This can be tedious for frequent use and will not work easily for compiled modules. If you have access to the shell of your python host, the excellent virtualenv package allows you to set up a private python environment with your own libraries.

To set up a virtual disk, you will do something like this in the shell:

 $ virtualenv $HOME/my_python $ $HOME/my_python/bin/easy_install numpy 

You can keep running easy_install for anything else you want to install in your personal python environment.

Now that you are writing python scripts, you will want to use your own python interpreter, if possible:

 #!/home/myuser/my_python/bin/python import numpy # script here 

If your python env cannot be specified (for example, if it is running mod_wsgi), you will need to add it to the import path:

 import sys sys.path.insert(0, '/home/myuser/my_python/lib/python2.5/site-packages') import numpy 

2: Website hosting with numpy

I can’t think of any hosting sites that offer numpy preinstalled. However, Dreamhost / Bluehost for sharedhosts does provide SSH access, and with shell access you can install numpy using the methods described above. Any virtual private server, such as Linode / Slicehost, will allow you to install anything you want.

3: AppEngine

As mentioned above, AppEngine will not let you install C extensions (but pure python functions work), so it is unlikely that numpy will work for you there, as I suspect that some of its functions use C accelerations.

+16
Jan 17 '10 at 7:10
source share

App Engine does not support any of numpy, scipy or matplotlib, alas.

If you know exactly which OS and CPU your host uses, you can do the identical installation for them, download and install the same version of Python that they use, download the sources of the required packages and build them in .so (or .pyd , in depending on the platform), and downloading them - sounds like a real de-force tour.

Any of the many many sites that offer basic virtual hosting (a virtual machine, usually Linux, with modest HW resources, but root privileges for you, access to the ssh shell and gcc you can use in particular) will be much easier to work - essentially You will download and install the software you need in much the same way as on your own Linux workstation!

+12
Jan 17
source share

2 What hosting sites exist (free or paid) in which Numpy / Matplotlib is installed

PythonAnywhere offers web hosting and a simple built-in IDE; many Python packages (including NumPy and Matplotlib) are pre-installed . There is a free plan that you can use for the game, and Premium and Hosting accounts with additional features are $ 5 and $ 10 per month, respectively.

Full disclosure: I work there ...

+7
May 18 '12 at 17:20
source share

I have no comments yet, but I can provide a "response".

3: AppEngine

Numpy is now available on the Google App Engine: https://code.google.com/p/googleappengine/issues/detail?id=190

However, matplotlib is still waiting: http://code.google.com/p/googleappengine/issues/detail?id=482 Perhaps more people playing a major role in this issue will make this happen.

I want to note that svgfig is an option since it is pure python: http://code.google.com/p/svgfig/

Update:

It turns out matplotlib is now available: https://developers.google.com/appengine/docs/python/tools/libraries27#matplotlib

+6
Mar 06 '12 at 19:10
source share



All Articles