Trouble with ipython

121 views
Skip to first unread message

Nathan

unread,
Apr 12, 2011, 3:00:58 PM4/12/11
to jug-users
When running
jug shell primes.py

I'm getting the missing ipython error even though it's installed.

jug: Error: could not import IPython libraries

IPython is necessary for `shell` command.

The ipython command works fine and "import IPython" works fine in a
python shell.

What could be wrong?

Luis Pedro Coelho

unread,
Apr 12, 2011, 3:11:52 PM4/12/11
to jug-...@googlegroups.com
Hi Nathan,

Thank you for your report.

Here are my guesses:

(1) if you are using a system like virtualenv, the different versions of
python are getting mixed up. Are you?

(2) maybe you are running a different version of ipython and I had not
realised the dependency. Does the following work (in a Python shell):

from IPython.Shell import IPShellEmbed
?

(The above is what jug actually runs and it is failing so you get the
error you saw).

HTH
--
Luis Pedro Coelho | Carnegie Mellon University | http://luispedro.org


Nathan

unread,
Apr 12, 2011, 3:38:09 PM4/12/11
to jug-users
Nope

>>> from IPython.Shell import IPShellEmbed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Shell
>>>

I installed jug first, before ipython with
easy_install jug

Then I tried installing IPython in several different ways. The first I
tried was
sudo port install py-ipython

It ran without errors, but ipython didnt work at the bash shell
afterwards.

Next I tried cloning ipython from github with
git clone git://github.com/ipython/ipython.git
cd ipython
sudo python setup.py install

but I got the same results. It didn't appear to be installed

Next I tried
easy_install ipython

That seemed to work because I could then run ipython from the bash
shell and import IPython from a python shell

FYI Im using an alternate installation of python than the one that
came with OSX.
I'm using 2.6 that was installed by macports

Nathan

unread,
Apr 12, 2011, 3:40:13 PM4/12/11
to jug-users
I can't stand IPython anyways, can I get the results from a jug run in
any other way?

Luis Pedro Coelho

unread,
Apr 12, 2011, 3:43:44 PM4/12/11
to jug-...@googlegroups.com
On Tue, 2011-04-12 at 12:40 -0700, Nathan wrote:
> I can't stand IPython anyways, can I get the results from a jug run in
> any other way?

Oh, you can always save it to a file.


from jug import TaskGenerator
from time import sleep

@TaskGenerator
def is_prime(n):
sleep(1.)
for j in xrange(2,n-1):
if (n % j) == 0:
return False
return True

@TaskGenerator
def save_results(filename, is_prime):
output = file(filename, 'w')
for i,p in enumerate(is_prime):
status = "is not prime"
if p: status = "is prime"
print >>output, 2+i, status
output.close()

primes100 = map(is_prime, xrange(2,101))
save_results('primes.txt', primes100)

HTH,

Nathan

unread,
Apr 12, 2011, 4:11:03 PM4/12/11
to jug-users
Ohhh, thanks.
I should have thought of that.
Reply all
Reply to author
Forward
0 new messages