9

I am running IPython notebook on an ubuntu vm. Everything works great so far, except I'm unable to do interactive matplotlib plots.

The error I get is: TclError: no display name and no $DISPLAY environment variable

And I'm just trying to follow these super basic tutorials.

http://nbviewer.ipython.org/github/jakevdp/matplotlib_pydata2013/tree/master/notebooks/

Any tips? I've done some research but nothing seems applicable to running iPython from an ubuntu machine. I know I'm overlooking something obvious.

After speaking with ThomasK about this, it seems I need to run %matplotlib nbaggs following %matplotlib inline from within iPython to get the interactivity from within my VM.

However, interactivity only came available in the latest release of matplotlib (1.4.x) and so I needed to upgrade from 1.3.x.

After running sudo pip install matplotlib --upgrade I got the following error in my .pip_log.

Any advice?

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib

PLEASE SEE HERE FOR A MUCH BETTER QUESTION: ipython notebook on linux VM running matplotlib interactive with nbagg

Community
  • 1
  • 1
user3659451
  • 1,913
  • 9
  • 30
  • 43
  • Have you done any research on this at all? If you search for `no display name and no $DISPLAY environment variable` it comes back with lots of results. Do none of the results help you? – Bryan Oakley Nov 10 '14 at 23:00
  • @BryanOakley I've done some research. I searched stackexchange. http://stackoverflow.com/questions/19409201/putty-tkinter-tclerror-no-display-name-and-no-diplay-environment-variable – user3659451 Nov 11 '14 at 01:54
  • @BryanOakley I also saw something that said stuff about X windows, and the following, but none of it seems applicable. If you can point me to some link I'll write up an answer to help out. "Looks like you are running this from a console. It looks like it is an X application and thus needs to be run from the GUI. You need to run "startx" and start a terminal and then run your python code from there." – user3659451 Nov 11 '14 at 01:56
  • Are you viewing the notebook inside the Ubuntu VM, or running it in a server VM and accessing it from your local machine? In the latter case, I'd expect an error like that; it's trying to display the plots in the VM. Using the nbagg backend for mpl might work. – Thomas K Nov 12 '14 at 02:14
  • @ThomasK sIt is the latter case. Thanks @ThomasK . I finally got that running `%matplotlib inline` or `%pylab inline` works to get the object-oriented matplots to appear. However, the buttons are merely in a png. How do I make them clickable? – user3659451 Nov 12 '14 at 04:50
  • Try `%matplotlib nbagg` - you'll need new-ish versions of both matplotlib and IPython for that to work. – Thomas K Nov 12 '14 at 18:44
  • So @ThomasK, I looked this up and this was patched just last month. Are you saying that most people with ipython notebook don't have the ability to have clickable buttons and sliders in their notebook? – user3659451 Nov 12 '14 at 22:59
  • by the way when this is solved i'll put up a solution which solves my original question. Thanks. – user3659451 Nov 12 '14 at 23:00
  • Most users can choose to have interactive plots pop out in a separate window, or static plots which appear within the notebook. In your case, because it's running on another computer, the plots in a separate window can't work. Being able to have interactive plots within the notebook is new, yes. – Thomas K Nov 13 '14 at 00:06
  • got it, thanks. How would I update things to allow for nbagg to work out? Do I have to wait until this feature is released? – user3659451 Nov 13 '14 at 00:55
  • @ThomasK I've put my error codes from `sudo pip install matplotlib --upgrade` – user3659451 Nov 13 '14 at 02:31
  • That doesn't seem to show what actually went wrong, unfortunately. – Thomas K Nov 13 '14 at 02:55
  • working on it: https://www.dropbox.com/s/d6ryre6qno16mp4/pip.log?dl=0 – user3659451 Nov 13 '14 at 04:07
  • ok i installed pkg-config and it went through the install successfully. Yes. But still the buttons do not work. :( I restarted my machine and ran a sudo apt-get update but no cigar. I verified a successful upgrade to 1.4.2. – user3659451 Nov 13 '14 at 04:39
  • 1
    @ThomasK Hi Thomas, I've summarized everything in a nice question here: http://stackoverflow.com/questions/26901890/ipython-notebook-on-linux-vm-running-matplotlib-interactive-with-nbagg – user3659451 Nov 13 '14 at 05:27

1 Answers1

16

Run this before

%matplotlib inline
Ganesh Satpute
  • 3,664
  • 6
  • 41
  • 78