pythonic-emacs/pythonic

interactive matplotlib in virtualenv

gmoutso opened this issue · 3 comments

Hi!
matplotlib.pyplot does not work in virtualenv with pythonic-activate

Steps to reproduce:

  1. Create an empty environment with virtualenv -p python2 test
  2. Activate with . test/bin/activate
  3. Install the MWE requisites with pip install ipython matplotlib pyside
  4. In your emacs session, pythonic-activate test
  5. run-python
  6. enter the magic command %matplotlib qt
  7. Next run import matplotlib.pyplot as plt and plt.figure()
    A figure should appear. It doesn't.

How it works in emacs without pythonic-activate:

  1. Without activating the virtualenv, run-python
  2. Run in the inferior mode the magic command %matplotlib qt
  3. Next run import matplotlib.pyplot as plt and plt.figure()
    A figure window should appear

How it works in a virtualenv outside emacs:

  1. Create an empty environment with virtualenv -p python2 test
  2. Activate with . test/bin/activate
  3. Install the MWE requisites pip install ipython matplotlib pyside
  4. enter an ipython session
  5. enter the magic command %matplotlib qt
  6. Next run import matplotlib.pyplot as plt and plt.figure()
    A figure should appear.

I'm unable to build pyside, so I can't confirm if it is a problem or not.

Thank you for your reply and for your work on anaconda mode. I thought this issue was a problem beyond pyside and pyqt. So I decided to test the same with the backend tkagg (which is the default) instead of qt. Now it works as expected! So the problem description is instead " interactive matplotlib in virtualenv with qt backend " using pythonic-activate.

For me, switching to tkagg when using a virtualenv is not a problem. Thanks!

PS. I can pip install pyside on ubuntu successfully but I also have kde installed on my system, which has qt libraries already installed. Maybe that is why you cannot install pyside.

I have libqt4-dev and cmake installed. Pip install fails with meaningless error message.