ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

matplotlib for ROS

asked 2020-07-12 05:06:00 -0500

Kansai gravatar image

I am building a docker container for using ROS.

I build and run the container and I wanted to use rqt_plot. To do this I had to install it with

$ sudo apt-get install ros-kinetic-rqt
$ sudo apt-get install ros-kinetic-rqt-common-plugins

However, this won't run rqt_plot due to the lack of matplotlib as explained in this answer

So I installed matplotlib with

python -m pip install -U pip
python -m pip install -U matplotlib

but I had to do

apt-get -y install python-pip

first. After that it worked.

Now I wanted to put all that in the dockerfile for next time but for some reason it fails. In the end I managed to install matplotlib from the docker file but now I get

Step 7/9 : RUN python -m pip install -U matplotlib
 ---> Running in 2021b190548b
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/9c/4b/06f4aa9bef6b5e4f177881b4dedd94faa6e7cb3d95dfaeaa8a1a8b541095/matplotlib-3.2.2.tar.gz (40.3MB)
    Complete output from command python setup.py egg_info:

    Beginning with Matplotlib 3.1, Python 3.6 or above is required.
    You are using Python 2.7.12.

    This may be due to an out of date pip.

    Make sure you have pip >= 9.0.1.


    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-MZvL14/matplotlib/
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The command '/bin/sh -c python -m pip install -U matplotlib' returned a non-zero code: 1
non-network local connections being added to access control list

So, it is installing matplotlib that uses python3 but ROS uses python2

I wonder why it worked when I did it inside the container and the main question How can I install matplotlib to use with ROS (python2) so that I can use rqt_plot?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-10-22 23:34:18 -0500

jorgeS gravatar image

I had the same problem, simply update pip first, then upgrade matplotlib:

pip install --upgrade pip
python2 -m pip install --upgrade matplotlib
edit flag offensive delete link more
0

answered 2020-07-13 11:15:49 -0500

Thomas D gravatar image

You could try to install the pip package with the Python2 version explicitly:

RUN python2 -m pip install -U matplotlib
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-07-12 05:06:00 -0500

Seen: 1,198 times

Last updated: Jul 13 '20