killian koepsell | 9 Feb 02:42
Picon

problem with ipython emacs mode

Hi,

I have a problem with tab completion in the (i)python mode of emacs
and am wondering if someone came across the same problem.

The problem is the following. If I press np.<TAB>, I get the following:

In [2]: import numpy as np

In [3]:    ...: np.

After a second press of the tab button, I get:

In [2]: import numpy as np

In [3]:    ...:
In [4]: ------------------------------------------------------------np.

Here is some system information: Mac OS 10.5.8
I haven't changed the emacs version (carbon emacs 22.3.1) and the
version of the python-mode.el and ipython.el recently. However, I
upgraded from python 2.5.4 (EPD 5.0.0) to python 2.6.4 (EPD 6.0.0) and
from IPython 0.9.1 to IPython 0.10. The problem does not seem to be
specific to the IPython version, since installing IPython 0.9.1 on top
of EPD 6 did not solve it.

Thanks,
  Kilian
killian koepsell | 9 Feb 03:14
Picon

Re: problem with ipython emacs mode

Another observation that might give a hint about what is going on:
When I press <TAB> at the empty prompt, I get the following completion
suggestion in the second emacs window:

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
------> print('
'.join(__IP.Completer.all_completions('')) #PYTHON-MODE SILENT)

Thanks,
  Kilian

On 2/8/10, killian koepsell <koepsell <at> gmail.com> wrote:

> Hi, > > I have a problem with tab completion in the (i)python mode of emacs > and am wondering if someone came across the same problem. > > The problem is the following. If I press np.<TAB>, I get the following: > > In [2]: import numpy as np > > In [3]: ...: np. > > After a second press of the tab button, I get: > > In [2]: import numpy as np > > In [3]: ...: > In [4]: ------------------------------------------------------------np. > > Here is some system information: Mac OS 10.5.8 > I haven't changed the emacs version (carbon emacs 22.3.1) and the > version of the python-mode.el and ipython.el recently. However, I > upgraded from python 2.5.4 (EPD 5.0.0) to python 2.6.4 (EPD 6.0.0) and > from IPython 0.9.1 to IPython 0.10. The problem does not seem to be > specific to the IPython version, since installing IPython 0.9.1 on top > of EPD 6 did not solve it. > > Thanks, > Kilian >
Fernando Perez | 9 Feb 04:27
Picon

Re: problem with ipython emacs mode


On Mon, Feb 8, 2010 at 9:14 PM, killian koepsell <koepsell <at> gmail.com> wrote: > Another observation that might give a hint about what is going on: > When I press <TAB> at the empty prompt, I get the following completion > suggestion in the second emacs window: > > Click <mouse-2> on a completion to select it. > In this buffer, type RET to select the completion near point. > > Possible completions are: > ------> print(' > '.join(__IP.Completer.all_completions('')) #PYTHON-MODE SILENT) >
Mmh, that stupid print() function transition again... Try in your emacs config file ;; Configure the ipython call for pylab use (setq py-python-command-args '("--autocall" "0")) And let's see if that helps... Cheers, f
killian koepsell | 9 Feb 07:48
Picon

Re: problem with ipython emacs mode

Fernando,

On 2/8/10, Fernando Perez <fperez.net <at> gmail.com> wrote:

> On Mon, Feb 8, 2010 at 9:14 PM, killian koepsell <koepsell <at> gmail.com> wrote: >> Another observation that might give a hint about what is going on: >> When I press <TAB> at the empty prompt, I get the following completion >> suggestion in the second emacs window: >> >> Click <mouse-2> on a completion to select it. >> In this buffer, type RET to select the completion near point. >> >> Possible completions are: >> ------> print(' >> '.join(__IP.Completer.all_completions('')) #PYTHON-MODE SILENT) >> > > Mmh, that stupid print() function transition again... > > Try in your emacs config file > > ;; Configure the ipython call for pylab use > (setq py-python-command-args '("--autocall" "0")) > > And let's see if that helps...
magic! indeed, that fixed it. you only realize how much you depend on its functionality when you lose it... thank you very much! kilian
Neal Becker | 9 Feb 12:38
Picon

Re: problem with ipython emacs mode


killian koepsell wrote: > Fernando, > > On 2/8/10, Fernando Perez <fperez.net <at> gmail.com> wrote: >> On Mon, Feb 8, 2010 at 9:14 PM, killian koepsell <koepsell <at> gmail.com> >> wrote: >>> Another observation that might give a hint about what is going on: >>> When I press <TAB> at the empty prompt, I get the following completion >>> suggestion in the second emacs window: >>> >>> Click <mouse-2> on a completion to select it. >>> In this buffer, type RET to select the completion near point. >>> >>> Possible completions are: >>> ------> print(' >>> '.join(__IP.Completer.all_completions('')) #PYTHON-MODE SILENT) >>> >> >> Mmh, that stupid print() function transition again... >> >> Try in your emacs config file >> >> ;; Configure the ipython call for pylab use >> (setq py-python-command-args '("--autocall" "0")) >> >> And let's see if that helps... > > magic! indeed, that fixed it. > you only realize how much you depend on its functionality when you lose > it... thank you very much! > > kilian
Yes, I needed this also! We need to either fix or document this somewhere.
killian koepsell | 9 Feb 14:19
Picon

Re: problem with ipython emacs mode

Fernando,


> On 2/8/10, Fernando Perez <fperez.net <at> gmail.com> wrote: >> Mmh, that stupid print() function transition again... >> >> Try in your emacs config file >> >> ;; Configure the ipython call for pylab use >> (setq py-python-command-args '("--autocall" "0")) >> >> And let's see if that helps...
even though this fixed the tab completion, there still seems to be a problem with the interpretation of multi-line input that looks related. Maybe you know what's going on here as well. The following statement only works in a single line. thanks, kilian In [34]: for i in range(3): print i ....: 0 1 2 In [35]: for i in range(3): ....: print i Display all 293 possibilities? (y or n) ------------------------------------------------------------ File "<ipython console>", line 2 t i ^ SyntaxError: invalid syntax
Fernando Perez | 9 Feb 17:38
Picon

Re: problem with ipython emacs mode


On Tue, Feb 9, 2010 at 8:19 AM, killian koepsell <koepsell <at> gmail.com> wrote: > In [34]: for i in range(3): print i >   ....: > 0 > 1 > 2 > > In [35]: for i in range(3): >   ....:        print i > > Display all 293 possibilities? (y or n) > ------------------------------------------------------------ >   File "<ipython console>", line 2 >     t i >       ^ > SyntaxError: invalid syntax
That looks really weird, and I have no idea, sorry. It's a shame that somehow we've managed to damage our emacs support without noticing late enough that finding the source of the problem isn't easy. Anyone who is willing to try and understand/fix this problem will get a lot of gratitude from us. Cheers, f
Jon Olav Vik | 8 Feb 20:11
Picon

How is a TaskClient "fault tolerant"? And can it play nice with PBS queueing?

I'm acquainting myself with parallel IPython and have a couple of questions.

1. Could someone please explain what it means that a TaskClient is "fault 
tolerant"?
http://ipython.scipy.org/doc/stable/html/parallel/parallel_task.html

2. The task interface sounds useful for embarrassingly parallel computations. 
I'm trying to follow the instructions at 
http://ipython.scipy.org/doc/stable/html/parallel/parallel_process.html#using-
ipcluster-in-pbs-mode
(PBS is the queueing system used by the computer cluster I'm working with).

I use the command 
ipcluster pbs -n 8 --pbs-script=pbs.template &
to run the following pbs script:

#PBS -N ipython
#PBS -j oe
#PBS -l walltime=00:10:00
#PBS -l nodes=${n/8}:ppn=8
#PBS -q express
cd $$PBS_O_WORKDIR
mpiexec -n ${n} ipengine --logfile=$$PBS_O_WORKDIR/ipengine &
sleep 30
python ipar.py

...where ipar.py starts a MultiEngineClient and execute()'s commands that use 
MPI on the ipengines. (I haven't tried using it with a TaskClient yet.)

Note that I'm starting mpiexec in the background; otherwise, it would never 
finish and my Python script would never get called. Also, I'm backgrounding the 
call to ipcluster because that too never seems to finish. (Using mpiexec with 
"python ipar.py" does not seem to be required.)

However, the compute cluster's user instructions say I shouldn't start 
processes in the background, because then they escape the control of the job 
scheduler. Is there a way I can make TaskClient() work under this restriction? 
Otherwise, I'm just going to manually "killall ipcluster" etc. once my job is 
done. (Or maybe that could go as the last lines of my pbs script?)

I'm a complete newbie in this, so any hints are highly appreciated.

Best regards,
Jon Olav Vik
Hassan Rom | 6 Feb 20:09
Picon

autocompletion of normal programs

Hello,

I'm running ipython with the shell profile and it works great! The
only problem I have with it currently is that ipython doesn't do
autocompletion for programs which would otherwise autocomplete fine if
I were to run them on bash. Is there a way to magically get these
programs to autocomplete in ipython too?

Thanks,
- Hassan
Ville M. Vainio | 8 Feb 08:26
Picon
Gravatar

Re: autocompletion of normal programs


On Sat, Feb 6, 2010 at 9:09 PM, Hassan Rom <putera.afandy <at> gmail.com> wrote: > I'm running ipython with the shell profile and it works great! The > only problem I have with it currently is that ipython doesn't do > autocompletion for programs which would otherwise autocomplete fine if > I were to run them on bash. Is there a way to magically get these > programs to autocomplete in ipython too?
Are you thinking of custom "bash completions": http://www.debian-administration.org/article/An_introduction_to_bash_completion_part_1 As of yet there is no magical way to do it, but I suppose the machinery can be used externally (invoking bash to do the work?). -- -- Ville M. Vainio http://tinyurl.com/vainio
Justin MacCallum | 4 Feb 21:46
Favicon

Problem calling subprocess from TaskClient

Hi,

I have a parallel scientific code that runs on clusters. It currently uses my own (badly designed) parallel
communication engine and I'm trying to transition to iPython's TaskClient interface. One part of my code
uses the subprocess module to wrap a call to a different piece of software. Unfortunately, this seems to be
causing problems for me. I'm running on OS X 10.6.2, with python 2.6.4 and ipython 0.10 as supplied by
MacPorts. The following code snippet will reproduce the problem I'm having.

-----
#!/usr/bin/env python

from IPython.kernel import client

tc = client.TaskClient()

@tc.parallel()
def remote_test(input):
    import subprocess
    # I'm obviously not wrapping ls, but I have the same problem with the real binary I'm trying to call
    subprocess.check_call('ls')
    return input

work = range(100)

results = remote_test(work)
-----

The output of this program
is:

-----
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/python/filepath.py:12:
DeprecationWarning: the sha module is deprecated; use the hashlib module instead
  import
sha
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/clientconnector.py:43:
DeprecationWarning: Importing class Tub directly from 'foolscap' is deprecated since Foolscap 0.4.3.
Please import foolscap.api.Tub instead
  self.tub =
Tub()
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/taskfc.py:79:
DeprecationWarning: Importing class Referenceable1 directly from 'foolscap' is deprecated since
Foolscap 0.4.3. Please import foolscap.api.Referenceable instead
  class FCTaskControllerFromTaskController(Referenceable):
Traceback (most recent call last):
  File "./test.py", line 15, in <module>
    results = remote_test(work)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/parallelfunction.py",
line 104, in call_function
    return self.mapper.map(self.func, *sequences)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/mapper.py",
line 230, in map
    task_results = [self.task_controller.get_task_result(tid) for tid in task_ids]
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/taskclient.py",
line 93, in get_task_result
    taskid, block)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/kernel/twistedutil.py",
line 72, in blockingCallFromThread
    return twisted.internet.threads.blockingCallFromThread(reactor, f, *a, **kw)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/internet/threads.py",
line 114, in blockingCallFromThread
    result.raiseException()
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0-py2.6-macosx-10.6-i386.egg/twisted/python/failure.py",
line 326, in raiseException
    raise self.type, self.value, self.tb
OSError: [Errno 4] Interrupted system call
-----

The ipcontroller log file looks like:

-----
2010-02-04 12:42:36-0800 [-] Running task 82 on worker 1
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Task completed: 82
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] distributing Tasks
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Running task 83 on worker 1
2010-02-04 12:42:36-0800 [Negotiation,2,192.168.0.194] Task 83 failed on worker 1
2010-02-04 12:42:36-0800 [-] distributing Tasks
2010-02-04 12:42:36-0800 [-] Running task 84 on worker 0
2010-02-04 12:42:36-0800 [Negotiation,0,192.168.0.194] Task 84 failed on worker 0
2010-02-04 12:42:37-0800 [-] distributing Tasks
2010-02-04 12:42:37-0800 [-] Running task 85 on worker 1
2010-02-04 12:42:37-0800 [Negotiation,2,192.168.0.194] Task 85 failed on worker 1
2010-02-04 12:42:37-0800 [-] distributing Tasks
2010-02-04 12:42:37-0800 [-] Running task 86 on worker 0
2010-02-04 12:42:37-0800 [Negotiation,0,192.168.0.194] Task 86 failed on worker 0
2010-02-04 12:42:38-0800 [-] distributing Tasks
2010-02-04 12:42:38-0800 [-] Running task 87 on worker 1
-----

Notice that a few of the tasks actually complete, while the majority fail with the strange interrupted
system call error.

I'd appreciate any help anyone can offer.

Thanks,
Justin

-----
Justin MacCallum
Post Doctoral Fellow
University of California San Francisco

Gmane