installing matplotlib ERROR: Command errored out with exit status -4

Viewed 936

I'm trying to install matplotlib in my Python env (rosnav) but I keep getting the same error:

(rosnav) ➜  ~ pip install matplotlib          
Collecting matplotlib
  Using cached matplotlib-3.3.4.tar.gz (37.9 MB)
    ERROR: Command errored out with exit status -4:
     command: /home/vis2020/python_env/rosnav/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/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-c45rjl2z
         cwd: /tmp/pip-install-pfyhcwif/matplotlib_ddf1d8a6a94c452bae24a255a1ffb9b8/
    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, Jan 26 2021, 15:33:00)  [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-c45rjl2z/matplotlib.egg-info
    writing /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/dependency_links.txt
    writing namespace_packages to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/namespace_packages.txt
    writing requirements to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/requires.txt
    writing top-level names to /tmp/pip-pip-egg-info-c45rjl2z/matplotlib.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-c45rjl2z/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.

I have look for solutions and they basically all tell me to run:

pip install --upgrade setuptools

in one way or the other. But this has not worked for me so far.

Has someone come across the same or a similar issue?

2 Answers

Solution

pip install --upgrade pip setuptools wheel
pip install numpy==1.19.4
pip install matplotlib

I had the same problem and I used the following command:

sudo apt-get install python3-matplotlib
Related