jetson nano how can install matplotlib??

jetson nano… i can’t install matplotlib…

please help… thanks

how can i~~~

Hi,

What kind of error do you meet?

I can install it with the following command:

sudo apt-get install python-matplotlib

Thanks.

1 Like

Hi AastaLLL

I can use matplotlib in python 2.7 with your suggestion, but the python 3.6.7 is not working, logs are shown below: Would you please help me for this? Thanks in advanced.

xxx@xxx:~/$ sudo apt-get install python-matplotlib

Reading package lists… Done
Building dependency tree
Reading state information… Done
python-matplotlib is already the newest version (2.1.1-2ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 210 not upgraded.
xxx@xxx:~/$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import matplotlib as plt
Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘matplotlib’

Modify the apt-get command with python3-matplotlib and it should work.

1 Like

yes , it is right. thanks very much. @mdegans

I’m trying to install scikit-image, and I’ve installed matplotlib through “sudo apt-get install python3-matplotlib”. However, it only installs 2.1.1, and scikit-image needs version 2.2.2. Any ideas on how to make things work?

For everyone trying to install a more recent version of matplotlib than provided by the Debian package, try installing from source. Just installing from source or by pip by itself leads to some missing C header errors, which is solved by:

sudo apt-get build-dep python3-matplotlib -y

This command may cause the following error:

Error :: You must put some ‘source’ URIs in your sources.list

which is solved by editing /etc/apt/sources.list.

Here’s a complete script which you can use that installs dependencies properly with no errors for me on a Jetson Nano.

sudo cp /etc/apt/sources.list /etc/apt/sources.list~
sudo sed -Ei ‘s/^# deb-src /deb-src /’ /etc/apt/sources.list
sudo apt-get update
cd ~/.local/lib/python3.6/site-packages
git clone -b v3.1.1 --depth 1 https://github.com/matplotlib/matplotlib.git
cd ~/.local/lib/python3.6/site-packages/matplotlib
sudo apt-get build-dep python3-matplotlib -y
pip install . -v
sudo mv /etc/apt/sources.list~ /etc/apt/sources.list
sudo apt-get update

This will add the matplotlib repository into the default path that pip packages are installed for the Jetson Nano, edit the sources.list file, and restore the sources.list file. You can change the version of the repo cloned by changing the version number, corresponding to tags on the matplotlib repo.

Hello,

This procedure above makes a local install of matplotlib, but how can I install matplotlib on a virtualenv? Thanks

Hi Juan,

Is there any chance you may found a solution?

Best regards Berk

Hi Berk,

I was unable to install matplotlib inside a virtualenv, but I found the recommendations in the following link. I have not been able to try it and since I will not be able to do it in the next 2 weeks, maybe you can try and tell us. What I did try was to make a symbolink link (ln -s ) which made the local matplotlib install visible inside the virtualenv, but all matplotlib dependencies where not found and installing them one by one is simply not realistic.

In general, I believe its advised to install packages which require C compilation outside of virtualenvs. Here’s a thread of how you can install some packages system-wide, and keep smaller, Python packages within your virtualenv:

Alright, I’m also trying to finish my master in two weeks but I will spare some time to look at it. Thanks for information. I will let you know when I can have a look.

Best wishes,

Hello,

I found two methods to get access (not installing) to matplotlib inside a virtualenv.

The first one is to use the --system-site-packages flag when creating the virtualenv, so that packages installed system wide are accessible from the virtualenv. For example:

virtualenv -p ref/bin/python myapp --system-site-packages

The second method, which came in very handy in the Nano, was to use virtualenv inheritance. In other words, create a virtualenv myapp using the --system-site-packages flag from an already created virtualenv ref, as follows:

virtualenv -p ref/bin/python myapp
realpath ref/lib/python3.6/site-packages > myapp/lib/python3.6/site-packages/base_venv.pth --system-site-packages

This can be used when you already have a virtualenv that was created without the --system-site-packages flag but that has all your required packages (which took a long time to build in the Nano). You would create a new virtualenv with access to all the packages already installed in your old virtualenv, but with access to the system site packages as well.

I found these two answers here: https://stackoverflow.com/questions/39409380/create-a-virtualenv-from-another-virtualenv

Good luck!

When I try to install with ‘apt install -y python3-matplotlib’ I get a screen asking for the timezone (continent&location), and when I select the right timezone it works OK.

I want to include the ‘apt install -y python3-matplotlib’ in a Dockerfile. How can I set the timezone without getting the timezone selection screen?

Thanks for the help.

Found the solution by putting this before the apt install:

ENV TZ=Europe/Brussels
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

Found it in this thread:
https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai

Is this solution valid for jetson tx2