'How to install matplotlib on Raspberry Pi 4 B?
I'm wondering if anyone might know why I'm unable to install matplotlib version 3.3.4 on my RPi 4B. I'm running Ubuntu 20.04.1 LTS with Python 3.6.13. Here is what I tried:
pip install matplotlib==3.3.4
However, I get a bunch of red text with an error telling me it failed to build the wheel. Here is the error output:
/usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/_backend_agg.cpython-36m-aarch64-linux-gnu.so.BXBFax.ltrans0.ltrans.o(.text+0x3fc): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
error: command 'aarch64-linux-gnu-g++' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for matplotlib
Running setup.py clean for matplotlib
Failed to build matplotlib
Installing collected packages: matplotlib
Running setup.py install for matplotlib ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-yhqnk_yg/matplotlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d9f_68ud/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6/matplotlib
cwd: /tmp/pip-install-yhqnk_yg/matplotlib/
It seems like there is an issue with the compilation of one of the dependencies but I'm not sure how to resolve this problem, or if it's just an issue with my specific OS. I've done an exhaustive search of the internet for a solution but it seems no one has had the same problem as me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
