I have problem when I use "from spyre import server"
Issue: File "/usr/local/lib/python2.7/dist-packages/spyre/server.py", line 16, in from cherrypy.lib.static import serve_file ImportError: No module named static
import matplotlib,jinja2
from spyre import server
import matplotlib.pyplot as plt
import numpy as np
class SimpleSineApp(server.App):
title = "Simple Sine App"
inputs = [{ "input_type":"text","variable_name":"freq","value":5,"action_id":"sine_wave_plot"}]
outputs = [{"output_type":"plot","output_id":"sine_wave_plot","on_page_load":True }]
def getPlot(self, params):
f = float(params['freq'])
print f
x = np.arange(0,2*np.pi,np.pi/150)
y = np.sin(f*x)
fig = plt.figure()
splt1 = fig.add_subplot(1,1,1)
splt1.plot(x,y)
return fig
app = SimpleSineApp()
app.launch()
How can I solve this issue?
I use Ubuntu 14.04 and Python 2.7.6
Thanks
Well, the following works for me. Of course this way you need all the -dev dependencies to build pandas
and matplotlib
.
virtualenv test
. test/bin/activate
pip install dataspyre
python spyredemo.py
I guess your exception is a dependency issue. If you installed cherrypy
from OS package repo you may have old version. Type in terminal pip freeze | grep cherrypy
and make sure it's at least >= 3.2. To test it open Python interactive console and type:
from cherrypy.lib.static import serve_file
If it doesn't work you need to upgrade CherryPy. You may need to remove the OS package before.
pip install -U cherrypy