all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* python-matplotlib: should it propagate numpy?
@ 2015-11-11 19:09 Federico Beffa
  2015-12-06 22:22 ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Federico Beffa @ 2015-11-11 19:09 UTC (permalink / raw)
  To: ricardo.wurmus; +Cc: Guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Hi Guix,
>
> with a profile containing python-2.7.10 and python2-matplotlib I did
> this:
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
> [rwurmus@guix-builder:~] $ export
> GI_TYPELIB_PATH="$HOME/.guix-profile/lib/girepository-1.0"
> [rwurmus@guix-builder:~] $ export
> PYTHONPATH=$HOME/.guix-profile/lib/python2.7/site-packages
> [rwurmus@guix-builder:~] $ python
> Python 2.7.10 (default, Oct  9 2015, 22:48:33)
> [GCC 4.9.3] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import matplotlib.pyplot as plt
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 180, in <module>
>     from matplotlib.cbook import is_string_like
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 33, in <module>
>     import numpy as np
> ImportError: No module named numpy
>>>>
> ~~~~~~~~~~~~~~~~~~~~~~~~

Yeah, we should propagate numpy really.

>
>
> So I installed python2-numpy into the same profile and tried again.
> This time the import statement did pass, but I cannot actually plot
> anything.
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
>>>> import matplotlib.pyplot as plt
>>>> import numpy as np
>>>> t = np.r_[0:5]
>>>> plt.plot(t, t)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 3092, in plot
>     ax = gca()
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 828, in gca
>     ax =  gcf().gca(**kwargs)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 462, in gcf
>     return figure()
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 435, in figure
>     **kwargs)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 110, in new_figure_manager
>     return new_figure_manager_given_figure(num, thisFig)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 117, in new_figure_manager_given_figure
>     canvas = FigureCanvasGTK3Agg(figure)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 25, in __init__
>     backend_gtk3.FigureCanvasGTK3.__init__(self, figure)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3.py", line 210, in __init__
>     self._idle_event_id = GLib.idle_add(self.idle_event)
>   File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/gi/types.py", line 44, in function
>     return info.invoke(*args)
> TypeError: Error invoking GLib.idle_add: Unexpected value for argument 'function'
>>>>
> ~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> Does anyone know how to make this work?  Is this related to bug #20888?

Yes, it looks like it is related to bug #20888. You may wont to try the
'magic' command '%matplotlib' before importing it.

Matplotlib supports several back-ends, some of them like 'Agg' can only
be used to generate files, while others like 'GTK3Agg' do support
interactive operation. Of all the interactive ones, 'GTK3Agg' was the
only one where we had all the pieces to make it work. Unfortunately an
upgrade of GTK+ did break interoperability with matplotlib.

I tried several times to fix the 'GTK3Agg' back-end without success. So,
after a while I started asking to include the library 'tkinter' in our
python (see bug #20889). This would allows us to use another interactive
back-end. We are almost there, but not quite yet.

In the mean time I discovered and packaged 'emacs-ob-ipython' which
allows one to use ipython, including plotting with maptlotlib, inside of
an org-mode buffer.

Regards,
Fede

^ permalink raw reply	[flat|nested] 8+ messages in thread
* python-matplotlib: should it propagate numpy?
@ 2015-11-11 16:40 Ricardo Wurmus
  0 siblings, 0 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2015-11-11 16:40 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

with a profile containing python-2.7.10 and python2-matplotlib I did
this:

~~~~~~~~~~~~~~~~~~~~~~~~
[rwurmus@guix-builder:~] $ export GI_TYPELIB_PATH="$HOME/.guix-profile/lib/girepository-1.0"
[rwurmus@guix-builder:~] $ export PYTHONPATH=$HOME/.guix-profile/lib/python2.7/site-packages
[rwurmus@guix-builder:~] $ python
Python 2.7.10 (default, Oct  9 2015, 22:48:33) 
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 180, in <module>
    from matplotlib.cbook import is_string_like
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/cbook.py", line 33, in <module>
    import numpy as np
ImportError: No module named numpy
>>> 
~~~~~~~~~~~~~~~~~~~~~~~~


So I installed python2-numpy into the same profile and tried again.
This time the import statement did pass, but I cannot actually plot
anything.


~~~~~~~~~~~~~~~~~~~~~~~~
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> t = np.r_[0:5]
>>> plt.plot(t, t)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 3092, in plot
    ax = gca()
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 828, in gca
    ax =  gcf().gca(**kwargs)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 462, in gcf
    return figure()
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 435, in figure
    **kwargs)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 110, in new_figure_manager
    return new_figure_manager_given_figure(num, thisFig)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 117, in new_figure_manager_given_figure
    canvas = FigureCanvasGTK3Agg(figure)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3agg.py", line 25, in __init__
    backend_gtk3.FigureCanvasGTK3.__init__(self, figure)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg/matplotlib/backends/backend_gtk3.py", line 210, in __init__
    self._idle_event_id = GLib.idle_add(self.idle_event)
  File "/home/rwurmus/.guix-profile/lib/python2.7/site-packages/gi/types.py", line 44, in function
    return info.invoke(*args)
TypeError: Error invoking GLib.idle_add: Unexpected value for argument 'function'
>>> 
~~~~~~~~~~~~~~~~~~~~~~~~


Does anyone know how to make this work?  Is this related to bug #20888?

~~ Ricardo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-15 17:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-11 19:09 python-matplotlib: should it propagate numpy? Federico Beffa
2015-12-06 22:22 ` Ludovic Courtès
2015-12-07  7:26   ` Federico Beffa
2015-12-08 17:08     ` Ludovic Courtès
2015-12-09 22:03     ` Ricardo Wurmus
2015-12-10 19:21       ` Federico Beffa
2015-12-15 17:15       ` Federico Beffa
  -- strict thread matches above, loose matches on Subject: below --
2015-11-11 16:40 Ricardo Wurmus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.