Discussion:
No Module Named pstats
(too old to reply)
Juha S.
2008-02-13 09:20:11 UTC
Permalink
Hi,

I'm trying to use the Python profilers to test my code, but I get the
following output for cProfile.run() at the interpreter:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats
import profile
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named profile


I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.
Chris
2008-02-13 09:41:56 UTC
Permalink
Post by Juha S.
Hi,
I'm trying to use the Python profilers to test my code, but I get the
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats
import profile
File "<stdin>", line 1, in <module>
ImportError: No module named profile
I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.
There is no module called 'profile', it's called 'cProfile'. Both
'cProfile' and 'pstats' are part of the standard distro, have you
tried downloading a new binary and installing it ?
Joshua Kugler
2008-02-13 19:08:20 UTC
Permalink
Post by Chris
Post by Juha S.
Hi,
I'm trying to use the Python profilers to test my code, but I get the
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats
import profile
File "<stdin>", line 1, in <module>
ImportError: No module named profile
I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.
There is no module called 'profile', it's called 'cProfile'. Both
'cProfile' and 'pstats' are part of the standard distro, have you
tried downloading a new binary and installing it ?
There is a module called profile, as well as cProfile. And as Ilias said,
you probably do have to install python-profile (or whatever package your
system places the profiler in).

j

Juha S.
2008-02-13 10:09:10 UTC
Permalink
Post by Juha S.
Hi,
I'm trying to use the Python profilers to test my code, but I get the
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.5/cProfile.py", line 80, in print_stats
import pstats
ImportError: No module named pstats
import profile
File "<stdin>", line 1, in <module>
ImportError: No module named profile
I'm on Ubuntu 7.10 with Python 2.5, and I can't seem to figure out
what's missing.
I think you have to install python-profiler.
Regards,
Ilias
Thanks! I apt-get installed the package and now cProfiler works correctly.
Loading...