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/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/cProfile.py", line 190, in <module>
main()
File "/usr/lib/python2.6/cProfile.py", line 183, in main
run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort)
File "/usr/lib/python2.6/cProfile.py", line 36, in run
result = prof.print_stats(sort)
File "/usr/lib/python2.6/cProfile.py", 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