Fernando Perez | 1 Jan 02:14
Picon
Favicon

Re: ipython installation

Hi Andreas,

I'm cc-ing the ipython user list, where these questions are best discussed so 
others can provide feedback and the answers are publicly archived.

Andreas Grimm wrote:
> Hi Fernando, 
> 
> I write you, because I have difficulties installing ipython 0.7.3. After unzipping the package I tried to
execute setup.py, but he doesn't find a module. I get the following output:
> 
> Traceback (most recent call last):
>   File "setup.py", line 18, in ?
>     from setupext import install_data_ext
>   File "/home/a-raas/quellcode/ipython-0.7.3/setupext/__init__.py", line 3, in ?
>     from install_data_ext import install_data_ext
>   File "/home/a-raas/quellcode/ipython-0.7.3/setupext/install_data_ext.py", line 7, in ?
>     from distutils.command.install_data import * #install_data
> ImportError: No module named distutils.command.install_data
> 
> Do I have to download another file file first or can you advise me, what to do on this error ? I tried version
7.2, too and get the same error. 
> 
> Thanks in advance and Merry Christmas, 
> Andreas Grimm

That's extremely strange.  The failing line in the traceback works under all 
reasonable versions of Python (at least those supported by ipython):

longs[~]> python2.3 -c 'from distutils.command.install_data import *'
(Continue reading)

Ville M. Vainio | 1 Jan 09:26
Picon
Gravatar

Re: ipython installation

On 1/1/07, Fernando Perez <Fernando.Perez <at> colorado.edu> wrote:

> Otherwise, I'd suspect that you may have a broken Python installation, because
>   distutils is part of the standard library.  I just can't see another
> possibility.

Well, debian's python installation is broken by default, in that you
need to install python-dev or somesuch to get distutils.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Ville M. Vainio | 1 Jan 09:29
Picon
Gravatar

Re: man page question

On 12/31/06, Fernando Perez <fperez.net <at> gmail.com> wrote:

> Quick question: I just registered 0.7.3, is that enough for the
> appropriate egg to be  correctly located, or do I need to do anything
> else?  The Cheeshop web pages don't make mention of a specific egg
> upload step.  If there's an extra command for it, we'll just add a
> stanza for it in the tools/release shell script so it just happens for
> all future releases without a chance for me forgetting it.

Registration should be enough, though I can't check now (need to leave
for a 2-month business trip to Sweden in 15 minutes or so - though I
*do* have net access there).

"python setup.by bdist upload"
"python setup.by bdist_egg upload"
"python setup.by sdist upload"

should work.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Fernando Perez | 1 Jan 17:41
Picon
Gravatar

Re: ipython installation

On 1/1/07, Ville M. Vainio <vivainio <at> gmail.com> wrote:
> On 1/1/07, Fernando Perez <Fernando.Perez <at> colorado.edu> wrote:
>
> > Otherwise, I'd suspect that you may have a broken Python installation, because
> >   distutils is part of the standard library.  I just can't see another
> > possibility.
>
> Well, debian's python installation is broken by default, in that you
> need to install python-dev or somesuch to get distutils.

Good god, I wonder who had such a flash of brilliance and thought this
was a good idea!  It seems that Ubuntu (>= Dapper) changed things a
little bit, because while the python-dev package description still
reads

#
Includes the python distutils, which were in a separate package up to
version 1.5.2.
#

the actual list of installed files doesn't list anything
distutils-related, and the /usr/lib/python2.4/distutils files are
actually listed in the python2.4 (plain, not -dev) package.

Someone at Ubuntu had the common sense to fix this Debian craziness,
even if they didn't update the package description.

But thanks for the catch, it sounds like the most plausible
explanation for the OP's problem.  I'm surprised Debian does this.

(Continue reading)

Fernando Perez | 1 Jan 22:12
Picon
Gravatar

Re: reducing function visibility in pylab

On 12/31/06, belinda thom <bthom <at> cs.hmc.edu> wrote:
> Hi,
>
> Is there a way to run w/the pylab flag but NOT have a pile of
> functions (e.g. plot, axis, ...) show up in the namespace?
>
> What I'd really like is to be able to start in pylab mode (so the
> threading stuff is set up), and then have two modules to show up (in
> such a way that %who can print their names). I'd also like for dir()
> to return very little (not the slew of functions pylab creates).
>
> I get half of what I want by doing:
>
>    ipython
>    <snip>
>    In [3]: import numpy as N
>    In [5]: import pylab as P
>    In [6]: who
>    N       P
>
> But then I've not started in the pylab mode needed for interactive
> drawing.

Unfortunately no.  The mpl initialization code is hard-wired in
IPython/Shell.py, around line 448:

        # Build a user namespace initialized with matplotlib/matlab features.
        user_ns = IPython.ipapi.make_user_ns(user_ns)

        exec ("import matplotlib\n"
(Continue reading)

Fernando Perez | 2 Jan 00:12
Picon
Gravatar

Re: debugging question

On 12/31/06, Ville M. Vainio <vivainio <at> gmail.com> wrote:
> On 12/31/06, belinda thom <bthom <at> cs.hmc.edu> wrote:
>
> > Is it possible to use run -d (or some debugging equivalent) to run a
> > particular function or method from w/in a module?
>
> Not currently, at least.

I just spent a bit of time with the pdb/bdb codes, and it's
unfortunately not well set up to easily support this.  The do_break()
command only accepts either a filename:linenumber pair, or a function
name but which must evaluate in an already set up execution context
where the file has already been loaded into memory and the debugger is
up and running.

So implementing this at the %run or %prun level would require parsing
the input file to find a suitable definition line number.  This is not
trivial without executing the file first, since it's possible to have
things like

if os.name=='foo':
  def bar(): a()
else:
  def bar(): b()

and by simple text analysis one can't know which is the correct
definition line number.

Regards,

(Continue reading)

belinda thom | 2 Jan 09:19
Favicon

doctests

Hello,

I was hoping I might be able to run doctest scripts from w/in  
ipython, but it appears to not be possible.

In particular, I get the following kinds of errors w/in ipython  
(which don't show up when using python):

Trying:
     t.name()
Expecting:
     'Tic-Tac-Toe 3-by-3 wins comprised of 3 contiguous pieces'
Out[63]: 'Tic-Tac-Toe 3-by-3 wins comprised of 3 contiguous pieces'

It seems the main problem is the "Out[63]:" header. Is there a way to  
strip these off these output prompts just for the period that such  
tests are running?

I've tried this using both the magic run and calling directly from  
the cmd line (e.g. importing and then calling the "do_test" function  
in a __name__ == __main__ block; both yield the same behavior.

Any insight you might have appreciated (or if you've got a better  
general purpose way to test .txt files, I'm all ears).

Thx,

--b
John Hunter | 2 Jan 20:34

pager to stdout


How can I make ipython page to stdout (eg "help" output) instead of to
my PAGER env var.  Alternatively, how can I set my PAGER env var to
make ipython page to stdout?

Thanks,
JDH

peds-pc311:~> ipython
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.3.svn -- An enhanced Interactive Python.
John Hunter | 2 Jan 20:44

Re: pager to stdout

>>>>> "John" == John Hunter <jdhunter <at> ace.bsd.uchicago.edu> writes:

    John> How can I make ipython page to stdout (eg "help" output)
    John> instead of to my PAGER env var.  Alternatively, how can I
    John> set my PAGER env var to make ipython page to stdout?

Oh my god, I'm a genius!

  > env PAGER=cat ipython -pylab
Ville M. Vainio | 2 Jan 20:54
Picon
Gravatar

Re: pager to stdout

On 1/2/07, John Hunter <jdhunter <at> ace.bsd.uchicago.edu> wrote:

> Oh my god, I'm a genius!
>
>   > env PAGER=cat ipython -pylab

Still, implementing _ip.options.pager option variable (that takes a
callable), or a hook wouldn't probably be too bad an idea...

(just thinking aloud)

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'

Gmane