Troubles installing Matplotlib on Nano with Python 3.7/3.8 (and a virtual env)

I’m new to the Nano but am trying to do something that we regularly do on RPi and other PCs - namely install the Raspberry Pi Meteor System (RMS). The RMS install is fairly straightforward, but it has a dependency on Python >= 3.7. So, the default install Jetson won’t work for me.

What I’ve done is…

  1. Install Python 3.7 w/ sudo apt install python3.7-dev
    1a. I’ve also tried Python 3.8 installed from source
  2. Create a virtual env with python3.7 -m venv vRMS (also tried with --system-site-packages and then pip’ing everything except matplotlib with a -I)
  3. Enter my venv with source ~/vRMS/bin/activate
  4. pip install --upgrade pip setuptools wheel (I end up with versions 21.0, 52.0.0, and 0.36.2 respectively)
  5. pip install numpy
  6. pip install Pillow
  7. pip install freetype-py pypng (also installed libfreetype and libpng system-wide)
  8. pip install gitpython scipy cython pyephem astropy paramiko (relevant to RMS, but doesn’t affect the outcome of the next step)
  9. pip install matplotlib
    9a. Try installing matplotlib from source

The output from step 9 (or 9a, for that matter) is…

Collecting matplotlib
  Using cached matplotlib-3.3.3.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status -4:
     command: /home/mike/vRMS/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rezgayjg/matplotlib_c0fbca83fd8b4552a8a22a15a6f02c6d/'"'"'; __file__='"'"'/tmp/pip-install-rezgayjg/matplotlib_c0fbca83fd8b4552a8a22a15a6f02c6d/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-p8ppq7gy
         cwd: /tmp/pip-install-rezgayjg/matplotlib_c0fbca83fd8b4552a8a22a15a6f02c6d/
    Complete output (19 lines):
    Edit setup.cfg to change the build options; suppress output with --quiet.
      matplotlib: yes [3.3.3]
          python: yes [3.8.7 (default, Jan 25 2021, 22:49:08)  [GCC 7.5.0]]
        platform: yes [linux]
     sample_data: yes [installing]
           tests: no  [skipping due to configuration]
          macosx: no  [Mac OS-X only]
    running egg_info
    creating /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info
    writing /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/dependency_links.txt
    writing namespace_packages to /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/namespace_packages.txt
    writing requirements to /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/requires.txt
    writing top-level names to /tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-p8ppq7gy/matplotlib.egg-info/SOURCES.txt'
WARNING: Discarding (from (requires-python:>=3.6). Command errored out with exit status -4: python egg_info Check the logs for full command output.

I’ve also tried installing matplotlib system-wide while not in a venv and get the same results. I’m stumped on this one. Does anyone out there have tips for installing matplotlib with Python 3.7 or 3.8?



I’ll reply to myself here… Of course, there are no wheels available. I can see that when I log the output to a file. After many lines similar to,

2021-01-26T10:59:18,647   Skipping link: none of the wheel's tags match: pp36-pypy36_pp73-manylinux2010_x86_64:
3ec40ecc61fd0f8fd3328ce55bc30e7a2aeb0 (from>=3.6)

I see…

2021-01-26T10:59:18,654 Given no hashes to check 46 links for project 'matplotlib': discarding no candidates

And, I’ve solved the problem after several days of pulling my hair out. It turns out that it was all related to the NumPy issue described here… Illegal instruction (core dumped) on import for numpy 1.19.5 on ARM64 · Issue #18131 · numpy/numpy · GitHub and here… " Illegal instruction (core dumped)" Xavier

When running with Python 3.7, NumPy 1.19.5 was being installed and it appears that there is an issue with OpenBLAS that can be solved by either exporting OPENBLAS_CORETYPE=ARMV8 before running python or simply installing NumPy 1.19.4 instead. I chose the latter. Here’s what I’ve now done.

python3.7 -m venv vRMS
source ~/vRMS/bin/activate
pip install --upgrade pip setuptools wheel
pip install numpy==1.19.4
pip install matplotlib

Hopefully this will help out anyone else that is facing the same problem.


Thanks, you saved my life. I faced a lot of problem when installing jetson nano.

Thanks, worked for me too.

Same issue and solution on the Xavier, while using python 3.6.9 in a venv, thanks for sharing!