Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 958
sudo-Boris Avatar asked Oct 21 '25 16:10

sudo-Boris


1 Answers

  • This issue is related to a numpy issue:
    • NumPy 1.19.5 was being installed and it appears that there is an issue with OpenBLAS
      • https://github.com/numpy/numpy/issues/18131
    • https://github.com/matplotlib/matplotlib/issues/19250
    • https://forums.developer.nvidia.com/t/troubles-installing-matplotlib-on-nano-with-python-3-7-3-8-and-a-virtual-env/166837
  • Downgrade or Install Numpy 1.19.4
  • Upgrade or Install Numpy 1.20.x (if you are using python > 3.6)

Solution

pip install --upgrade pip setuptools wheel
pip install numpy==1.19.4
pip install matplotlib
like image 175
Trenton McKinney Avatar answered Oct 23 '25 05:10

Trenton McKinney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!