Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web_backend is not installed #1638

Closed
bmu opened this issue Jan 7, 2013 · 16 comments · Fixed by #1651
Closed

web_backend is not installed #1638

bmu opened this issue Jan 7, 2013 · 16 comments · Fixed by #1651

Comments

@bmu
Copy link

bmu commented Jan 7, 2013

I just wanted to test the new web_backend. So I cloned matplotlib (last commit 3f76b21, 01-07-2013) and installed it in a virtualenv with

pip install -e matplotlib

in my matplotlibrc I set the backend with

backend: WebAgg
webagg.port: 8888
webagg.open_in_browser: True

However nothing happens, when I plot something and I cannot access http://127.0.0.1:8888/1/.

If I look at my site-packages, in matplotlib/backends there is no web_backend directory nor a backend_webagg.py.

Maybe this is related to setup.py: in packages web_backend is not included.

How can I use the web backend?

@jenshnielsen
Copy link
Member

I just tried the webagg backend. The backend_webagg.py file is installed for me but the web_backend dir is not.
This is due to a missing web_static to web_backend rename in setup.py.

I only tried installing it using python setup.py install not pip

@mdboom
Copy link
Member

mdboom commented Jan 7, 2013

Sorry about that. Thanks for the report. I've fixed this directly on master.

@mdboom mdboom closed this as completed Jan 7, 2013
@mdboom mdboom reopened this Jan 7, 2013
@mdboom
Copy link
Member

mdboom commented Jan 7, 2013

Sorry for the accidental closure. @bmu, could you update to the latest master and report back whether it works for you?

@bmu
Copy link
Author

bmu commented Jan 7, 2013

I just installed latest master directly from github (as pip -e doesn't realy installs the files but creates a link).

The web_backend directory and backend_webagg.py seems to be on the rigth place.

However if I plot something I don't get a connection to http://127.0.0.1:8888/1/

I added a print statement to backend_webagg.py and it seems to be imported.
Not sure whtas going wrong.

I'm working with ipython in pylab mode. Could this be a problem?

Can you give a small working example as a script, so that I can check if this works?

@mdboom
Copy link
Member

mdboom commented Jan 7, 2013

Perhaps the step your missing is calling fig.show(). Any of the examples included with matplotlib that display a figure should work. One of the more fun ones is examples/animation/double_pendulum_animated.py.

It should work fine inside of ipython (either console or notebook), but it isn't integrated into the notebook in any way yet -- it will feed to a separate browser page.

@bmu
Copy link
Author

bmu commented Jan 8, 2013

I tried

ipython --pylab
Python 2.7.3rc2 (default, Mar 22 2012, 04:35:15) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

imported web backend # this is printed from backend_webagg.py, so the backend is imported

Welcome to pylab, a matplotlib-based Python environment [backend: WebAgg].
For more information, type 'help(pylab)'.

In [1]: rcParams['webagg.open_in_browser'] = True

In [2]: rcParams['webagg.port'] = 8888

In [3]: fig, ax = plt.subplots()

In [4]: ax.plot(arange(100))
Out[4]: [<matplotlib.lines.Line2D at 0x4660090>]

In [5]: fig.show()

but nothing shown at http://127.0.0.1:8888/1/

@jenshnielsen
Copy link
Member

It does not work for me with pylab either.
This is not entirely surprising since pylab in IPython does not know about the
webagg backend. Can you please try without pylab.

What definitly works for me in IPython is:

import matplotlib
matplotlib.use('webagg')
import matplotlib.pyplot as plt
plt.plot(range(10))
plt.show()

@bmu
Copy link
Author

bmu commented Jan 8, 2013

$ ipython
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import matplotlib as mpl

In [2]: mpl.use('webagg')

In [3]: mpl.rcParams['backend']
Out[3]: 'WebAgg'

In [4]: import matplotlib.pyplot as plt

In [5]: plt.plot(range(10))
Out[5]: [<matplotlib.lines.Line2D at 0x2eaabd0>]

In [6]: plt.show()

than (I think) a qt4 window pop up! I'm on a debian mashine with iceweasel 3.5.16 now. Is this a problem?

@mdboom
Copy link
Member

mdboom commented Jan 8, 2013

I can confirm this in IPython. I didn't do any of my testing in IPython -- IPython is obviously changing the environment for us somehow.

@bmu: Let's confirm that the known working environment works for you first. Can you cd to examples/pylab_examples and run python simple_plot.py -d webagg? Does that open up a page in your browser?

@jenshnielsen
Copy link
Member

If Iceweasel 3.5 is equivalent to Firefox 3.5 I don't think this will not work since it does not have websockets support. I believe you need at least Firefox/Iceweasel 11.

@jenshnielsen
Copy link
Member

For me using Firefox 17.0.1 and IPython 0.13.1 it works with both IPython Qtconsole and standard IPython provided that pylab is not enabled.

@bmu
Copy link
Author

bmu commented Jan 9, 2013

python simple_plot.py works on ubuntu 12.10 with firefox 17 and it looks good!

It doesn'work from within ipython even if I simply use %run simple_plot.py

I will later post if it works on debian/iceweasel 3.5 (which should be equivalent to firefox 3.5).

@bmu
Copy link
Author

bmu commented Jan 9, 2013

As a site note: Just updated to firefox 18 and python simple_plot.py works.

@bmu
Copy link
Author

bmu commented Jan 9, 2013

python simple.py seems to work on debian with python 2.6 (python version on ubuntu was 2.7), except that I get an error message from iceweasel 3.5:

Your browser does not have WebSocket support.Please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported but you have to enable WebSockets in about:config.

However this seems to be desired/expected.

@mdboom
Copy link
Member

mdboom commented Jan 10, 2013

@bmu: Can you test PR #1651 and let me know whether it addresses the issue of not running within ipython --pylab for you?

@bmu
Copy link
Author

bmu commented Jan 14, 2013

See my answer to #1651 (works but blocks the prompt).

@mdboom mdboom closed this as completed Jan 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants