SJ Moon
SJ Moon

Reputation: 51

Jetson AGX Xavier python3 matplotlib 3.3.4 installation error

I want to use yolov5 at my Jetson AGX Xavier developer kit and I have to upgrade matplotlib to version 3.3.4 highest version that python3.6 support. I'm using python version 3.6.9(default of Jetson AGX Xavier) and python3.6 support matplotlib version 3.3.4. But I CANNOT upgrade that over 2.1.1(and this version is default also).

I've upgrade setuptools and I tried all command I can.

$ sudo apt-get install python3-matplotlib
$ python3 -m pip install --upgrade matplotlib
$ python3 -m pip install matplotlib==3.3.4

How can I solve this problem?

Error code and image is here.

Defaulting to user installation because normal site-packages is not writeable
Collecting matplotlib==3.3.4
  Using cached matplotlib-3.3.4.tar.gz (37.9 MB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status -4:
   command: /usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tk3o5hkn/matplotlib_53b7f655efb14a6a9d86b117497e1927/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tk3o5hkn/matplotlib_53b7f655efb14a6a9d86b117497e1927/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-sz1ykkr8
       cwd: /tmp/pip-install-tk3o5hkn/matplotlib_53b7f655efb14a6a9d86b117497e1927/
  Complete output (19 lines):
  
  Edit setup.cfg to change the build options; suppress output with --quiet.
  
  BUILDING MATPLOTLIB
    matplotlib: yes [3.3.4]
        python: yes [3.6.9 (default, Dec  8 2021, 21:08:43)  [GCC 8.4.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-sz1ykkr8/matplotlib.egg-info
  writing /tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/PKG-INFO
  writing dependency_links to /tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/dependency_links.txt
  writing namespace_packages to /tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/namespace_packages.txt
  writing requirements to /tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/requires.txt
  writing top-level names to /tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/top_level.txt
  writing manifest file '/tmp/pip-pip-egg-info-sz1ykkr8/matplotlib.egg-info/SOURCES.txt'
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/22/d4/e7ca532e68a9357742604e1e4ae35d9c09a4a810de39a9d80402bd12f50f/matplotlib-3.3.4.tar.gz#sha256=3e477db76c22929e4c6876c44f88d790aacdf3c3f8f3a90cb1975c0bf37825b0 (from https://pypi.org/simple/matplotlib/) (requires-python:>=3.6). Command errored out with exit status -4: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement matplotlib==3.3.4 (from versions: 0.86, 0.86.1, 0.86.2, 0.91.0, 0.91.1, 1.0.1, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.3.0, 1.3.1, 1.4.0, 1.4.1rc1, 1.4.1, 1.4.2, 1.4.3, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 2.0.0b1, 2.0.0b2, 2.0.0b3, 2.0.0b4, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc1, 2.1.0, 2.1.1, 2.1.2, 2.2.0rc1, 2.2.0, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 3.0.0rc2, 3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.1.0rc1, 3.1.0rc2, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.2.0rc1, 3.2.0rc3, 3.2.0, 3.2.1, 3.2.2, 3.3.0rc1, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.4)
ERROR: No matching distribution found for matplotlib==3.3.4

error

Upvotes: 0

Views: 1850

Answers (5)

lilei
lilei

Reputation: 1

Execute the command

export OPENBLAS_CORETYPE=ARMV8 

and then run

pip install matplotlib

Upvotes: 0

RapidEdgeAI
RapidEdgeAI

Reputation: 21

I had the same problem on the JetPack 4.6.1 SD card image for Nvidia Jetson Nano. Unfortunately SJ Moon's answer didn't work for me. However, I figured out that I needed to upgrade the setuptools module. After upgrading it I could install matplotlib.
Please note that I am using a virtual environment for my Python application.

I created a virtual environment so that my python application is independent from the global python environment

python3 -m venv .venv # create virtual environment
source .venv/bin/activate # activate virtual environment

I upgraded pip because JetPack 4.6.1 comes with an old pip version and matplotlib requires pip >= 9.0.1

pip3 install --upgrade pip

Then I upgraded setuptools

pip3 install --upgrade setuptools

Then I was able to install matplotlib

pip3 install matplotlib

Also please note for this approach:
You will also use numpy if you use matplotlib. If you install numpy (pip3 install numpy) for Python 3.6, you will get numpy 1.19.5. Importing numpy (python3 -c "import numpy") will result in Illegal instruction (core dumped). This is because of an issue in numpy 1.19.5 for arm64 (see this GitHub issue). You can avoid this issue by installing another numpy version like 1.19.4

pip3 install numpy==1.19.4

or by setting OPENBLAS_CORETYPE=ARMv8, as suggested by SJ Moon and in the GitHub issue

export OPENBLAS_CORETYPE=ARMV8
pip3 install numpy

I didn't try the latter one, but this could be useful if you require numpy 1.19.5 for some reason.

Upvotes: 2

foodywater
foodywater

Reputation: 1

Adding

export OPENBLAS_CORETYPE=ARMV8

To my ~/.bash_rc worked for me as well.

Upvotes: 0

SJ Moon
SJ Moon

Reputation: 51

I solved this problem!!!!

This line was added to bashrc and the problem was solved.

export OPENBLAS_CORETYPE=ARMV8 python3

Upvotes: 2

It seems that your python packages have broken, There can be two ways to install matplotlib

Way-1: Try to install matplotlib in venv

Way-2: Uninstall python and then reinstall python again.

Note: In Second way, don't restart jetson until new python installed completely, because python3 is already comes with jetson, so if you will uninstall it and then restart jetson, it will not work fine.

Upvotes: 0

Related Questions