Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mprof run <executable> gets me "Command not found"

I am using Ubuntu 18.04 and Python 3. I have installed memory_profiler using the following command:

pip3 install -U memory_profiler

I was able to run python3 -m memory_profiler <executable> from the command line with no issues. However, if I try mprof run <executable> I get the following output:

Command 'mprof' not found, did you mean:

  command 'gprof' from deb binutils
  command 'pprof' from deb tau
  command 'mlprof' from deb mlton-tools
  command 'sprof' from deb libc-dev-bin
  command 'prof' from deb profphd

Try: sudo apt install <deb name>

I am following the steps in the documentation of memory_profiler here but it's not working. Is there any extra step given the fact that I use Python 3?

like image 904
YamiOmar88 Avatar asked Mar 01 '26 05:03

YamiOmar88


1 Answers

One way to make it work is the following. Instead of mprof run <executable>, the following works:

python3 /home/myuser/.local/lib/python3.6/site-packages/mprof.py run <executable>

You must replace myuser with the appropriate value. Your full path may differ. You need to find where is mprof.py. The general command is: python3 /full/path/to/mprof.py run <executable>.

like image 66
YamiOmar88 Avatar answered Mar 04 '26 22:03

YamiOmar88



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!