Nikolay Blokhin Facebook Nikolay Blokhin Photos Nikolay Blokhin Linkedin Nikolay Blokhin Twitter

Hi, I'm Nikolay Blokhin I build the cool things with Python and Swift

Error on Ubuntu: ImportError: No module named pstats

When I started using cProfile (part of the Python Standard Library), I got a strange error:

Traceback (most recent call last):
File "/usr/lib/python2.6/", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.6/", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/", line 190, in <module>
File "/usr/lib/python2.6/", line 183, in main
run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort)
File "/usr/lib/python2.6/", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.6/", line 80, in print_stats
import pstats
ImportError: No module named pstats

To correct this error (and bug), you need to install the module 'python-profiler':

sudo apt-get install python-profiler