Hi,
I’ve installed matplotlib in a virtual environment but am having a problem with generating a plot.
I’ve tried to run a “simple_plot.py” both as a script and from within the ipython/python shell.
I’ve changed the backend in virtualenvs/…/lib/python2.6/site-packages/matplotlig/mpl-data/matplotlibrc
from the within the virtualenv (regular python) shell I can:
import _tkinter
import Tkinter
Tkinter._test()
(and the test window opens as expected)
My virtualenv sys.path includes: "/home/virtualenvs/…/lib/python2.6/lib-tk’
When I try to use ipython -pylab (or run a script) I’m getting an error:
… import _tkagg
ImportError: No module named _tkagg
I’m assuming that there’s a relatively simple fix for this related to the “matplotlibrc” backend but can’t for the life of me work out how to get it fixed. I’d be grateful for any help.
Many thanks,
Rob
···
to: “backend : TkAgg”
The tkagg backend requires a compiled C extension (_tkagg) built when matplotlib is built. If Tkinter was not available at the time matplotlib was built, then that extension may not exist. If you can provide the output of a clean matplotlib build (i.e. remove the build directory first) that would be the best way to diagnose that problem.
Alternatively, you can switch to one of the other backends (which do not require a C extension as a bridge between matplotlib and GUI framework), such as GtkAgg, Qt4Agg, WxAgg etc. See here to learn how to switch backends:
http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
Mike
···
On 06/09/2010 10:47 AM, Robert Sudwarts wrote:
Hi,
I've installed matplotlib in a virtual environment but am having a problem with generating a plot.
I've tried to run a "simple_plot.py" both as a script and from within the ipython/python shell.
I've changed the backend in virtualenvs/.../lib/python2.6/site-packages/matplotlig/mpl-data/matplotlibrc
to: "backend : TkAgg"
from the within the virtualenv (regular python) shell I can:
>>> import _tkinter
>>> import Tkinter
>>> Tkinter._test()
(and the test window opens as expected)
My virtualenv sys.path includes: "/home/virtualenvs/.../lib/python2.6/lib-tk'
When I try to use ipython -pylab (or run a script) I'm getting an error:
.... import _tkagg
ImportError: No module named _tkagg
I'm assuming that there's a relatively simple fix for this related to the "matplotlibrc" backend but can't for the life of me work out how to get it fixed. I'd be grateful for any help.
--
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
I don’t know if this is the same issue that I had once, but I will just throw it out there. Once I compiled matplotlib myself before double-checking that I had all the needed development files and so the build process didn’t produce all the files for tkagg and used GTKAgg instead. I had to get all the needed development packages and completely clean out my build directory and rebuild matplotlib before it would work properly.
Ben Root
···
On Wed, Jun 9, 2010 at 9:47 AM, Robert Sudwarts <robert.sudwarts@…287…> wrote:
Hi,
I’ve installed matplotlib in a virtual environment but am having a problem with generating a plot.
I’ve tried to run a “simple_plot.py” both as a script and from within the ipython/python shell.
I’ve changed the backend in virtualenvs/…/lib/python2.6/site-packages/matplotlig/mpl-data/matplotlibrc
to: “backend : TkAgg”
from the within the virtualenv (regular python) shell I can:
import _tkinter
import Tkinter
Tkinter._test()
(and the test window opens as expected)
My virtualenv sys.path includes: "/home/virtualenvs/…/lib/python2.6/lib-tk’
When I try to use ipython -pylab (or run a script) I’m getting an error:
… import _tkagg
ImportError: No module named _tkagg
I’m assuming that there’s a relatively simple fix for this related to the “matplotlibrc” backend but can’t for the life of me work out how to get it fixed. I’d be grateful for any help.
Many thanks,
Rob
ThinkGeek and WIRED’s GeekDad team up for the Ultimate
GeekDad Father’s Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Thanks to both of you for your replies.
I should have included the info that I’ve tried to build matplotlib using virtualenv with the --no-site-packages option.
… And in the meantime, I have an existing (and working) build, courtesy of the Ubuntu package manager.
Seeing as the package manager version is working, I’m going to scrub everything that I currently have (including any build directories which have been created along the way) and start from scratch… I’ll let you know if that works!!
Thanks again,
Rob
···
On 9 June 2010 18:26, Benjamin Root <ben.root@…1304…> wrote:
I don’t know if this is the same issue that I had once, but I will just throw it out there. Once I compiled matplotlib myself before double-checking that I had all the needed development files and so the build process didn’t produce all the files for tkagg and used GTKAgg instead. I had to get all the needed development packages and completely clean out my build directory and rebuild matplotlib before it would work properly.
Ben Root
On Wed, Jun 9, 2010 at 9:47 AM, Robert Sudwarts <robert.sudwarts@…287…> wrote:
Hi,
I’ve installed matplotlib in a virtual environment but am having a problem with generating a plot.
I’ve tried to run a “simple_plot.py” both as a script and from within the ipython/python shell.
I’ve changed the backend in virtualenvs/…/lib/python2.6/site-packages/matplotlig/mpl-data/matplotlibrc
to: “backend : TkAgg”
from the within the virtualenv (regular python) shell I can:
import _tkinter
import Tkinter
Tkinter._test()
(and the test window opens as expected)
My virtualenv sys.path includes: "/home/virtualenvs/…/lib/python2.6/lib-tk’
When I try to use ipython -pylab (or run a script) I’m getting an error:
… import _tkagg
ImportError: No module named _tkagg
I’m assuming that there’s a relatively simple fix for this related to the “matplotlibrc” backend but can’t for the life of me work out how to get it fixed. I’d be grateful for any help.
Many thanks,
Rob
ThinkGeek and WIRED’s GeekDad team up for the Ultimate
GeekDad Father’s Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Some success!
I think my lack of understanding of how virtualenv (and dist- vs site-packages) actually works is to blame… The “–no-site-packages” flag does what it says on the tin and the dist-packages are available whether or not this option is used…
Hence, no need (in my case) to build matplotlib in the virtualenv …
···
On 9 June 2010 19:06, Robert Sudwarts <robert.sudwarts@…287…> wrote:
Thanks to both of you for your replies.
I should have included the info that I’ve tried to build matplotlib using virtualenv with the --no-site-packages option.
… And in the meantime, I have an existing (and working) build, courtesy of the Ubuntu package manager.
Seeing as the package manager version is working, I’m going to scrub everything that I currently have (including any build directories which have been created along the way) and start from scratch… I’ll let you know if that works!!
Thanks again,
Rob
On 9 June 2010 18:26, Benjamin Root <ben.root@…3146…4…> wrote:
I don’t know if this is the same issue that I had once, but I will just throw it out there. Once I compiled matplotlib myself before double-checking that I had all the needed development files and so the build process didn’t produce all the files for tkagg and used GTKAgg instead. I had to get all the needed development packages and completely clean out my build directory and rebuild matplotlib before it would work properly.
Ben Root
On Wed, Jun 9, 2010 at 9:47 AM, Robert Sudwarts <robert.sudwarts@…1896…> wrote:
Hi,
I’ve installed matplotlib in a virtual environment but am having a problem with generating a plot.
I’ve tried to run a “simple_plot.py” both as a script and from within the ipython/python shell.
I’ve changed the backend in virtualenvs/…/lib/python2.6/site-packages/matplotlig/mpl-data/matplotlibrc
to: “backend : TkAgg”
from the within the virtualenv (regular python) shell I can:
import _tkinter
import Tkinter
Tkinter._test()
(and the test window opens as expected)
My virtualenv sys.path includes: "/home/virtualenvs/…/lib/python2.6/lib-tk’
When I try to use ipython -pylab (or run a script) I’m getting an error:
… import _tkagg
ImportError: No module named _tkagg
I’m assuming that there’s a relatively simple fix for this related to the “matplotlibrc” backend but can’t for the life of me work out how to get it fixed. I’d be grateful for any help.
Many thanks,
Rob
ThinkGeek and WIRED’s GeekDad team up for the Ultimate
GeekDad Father’s Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users