Not able to plot graph: matplotlib is needed for plotting

后端 未结 4 1550
自闭症患者
自闭症患者 2021-01-18 13:01

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         


        
相关标签:
4条回答
  • 2021-01-18 13:45

    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.

    0 讨论(0)
  • 2021-01-18 13:46

    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:

    1. delete files in /usr/lib64/python2.7/site-packages/ connected with matplotlib (or you can uninstall matplotlib using the ordinary way)

    2. 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)

    3. 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.

    0 讨论(0)
  • 2021-01-18 13:47

    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

    0 讨论(0)
  • 2021-01-18 14:01

    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.
    0 讨论(0)
提交回复
热议问题