I am able to generate *.dat file:
vikas@server:~/memory_profiler-0.36$ ./mprof run --python test_sl.py
vikas@server:~/memory_profiler-0.36$ ls *.dat
mprofil
I had same problem on freshely installed Ubuntu 16.04. To solve it, I have installed SciPy like this:
sudo pip install scipy
Also I had to install tkinter
lib like this:
sudo apt-get install python-tk
I guess somewhere in the past, matplotlib had scipy
as dependency, but now it only has numpy, while mprof plot
requires scipy
.
I had the same problem. I used memory_profiler lib typing this commands
(mprof run runner.py
and mprof plot
) and got a message "matplotlib is needed for plotting"
I tried to get rid of this problem following advice I found here but in the result I solved this problem completing these simple steps:
delete files in /usr/lib64/python2.7/site-packages/ connected with matplotlib (or you can uninstall matplotlib using the ordinary way)
use sudo yum-builddep python-matplotlib
to install connected packages (222 packages were installed, if you need apt-get, you need this command: sudo apt-get build-dep python-matplotlib
)
install matplotlib sudo yum reinstall python-matplotlib
(or use install command, with apt-get: sudo apt-get install python-matplotlib
)
I believe this will help.
It seems matplotlib: 3.0.1 does not go well with python 3.7 in conda environment. df.plot() command could not be executed properly showing "ImportError: matplotlib is required for plotting" but actually matplotlib is installed.
I tried to downgrade matplotlib to 3.0.0 then everything is fine.
conda install -n [your_conda_envionment] matplotlib==3.0.0
You need to install matplotlib
, as instructed (this error in thrown by mprof when it can't find matplotlib).
You can do so using pip pip install matplotlib
(you might need to prefix this with sudo
) or your package manager:
sudo apt-get install -y python-matplotlib
on Debian, Ubuntu and derivatives.sudo yum install -y python-matplotlib
on RHEL, CentOS and derivatives.