Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ipython notebook - $DISPLAY variable error [duplicate]

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

like image 311
user3659451 Avatar asked Nov 10 '14 22:11

user3659451


People also ask

What is %% capture in Python?

IPython has a cell magic, %%capture , which captures the stdout/stderr of a cell. With this magic you can discard these streams or store them in a variable. from __future__ import print_function import sys. By default, %%capture discards these streams. This is a simple way to suppress unwanted output.

Why is my Jupyter notebook code not working?

Jupyter doesn't load or doesn't work in the browserTry disabling any browser extensions and/or any Jupyter extensions you have installed. Some internet security software can interfere with Jupyter. If you have security software, try turning it off temporarily, and look in the settings for a more long-term solution.

Why the output is not showing in Jupyter notebook?

It is your expection that needs to be adapted. The Jupyter Notebook only shows what the last statement of a cell evaluates to. If you define a function, this does not evaluate to anything that could be displayed. So you can't see anything in the upper cell.

How do I check my Jupyter notebook output?

Jupyter Notebook can print the output of each cell just below the cell. When you have a lot of output you can reduce the amount of space it takes up by clicking on the left side panel of the output. This will turn the output into a scrolling window.


1 Answers

Run this before

%matplotlib inline
like image 163
Ganesh Satpute Avatar answered Sep 18 '22 13:09

Ganesh Satpute