Sample Header Ad - 728x90

How to upgrade numpy? | ImportError: Matplotlib requires numpy>=1.23; you have 1.21.5

0 votes
1 answer
479 views
I need to run matplotlib. However, it requires an up-to-date version of numpy. How can I manually update my numpy installation?
$ pip install numpy --upgrade
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy in /home/n4089/.local/lib/python3.10/site-packages (2.2.3)
ImportError                               Traceback (most recent call last)
Cell In, line 3
      1 import random,multiprocess,os,json,re
      2 import numpy as np
----> 3 import matplotlib.pyplot as plt

File ~/.local/lib/python3.10/site-packages/matplotlib/__init__.py:264
    259         if parse_version(module.__version__) ={minver}; "
    261                               f"you have {module.__version__}")
--> 264 _check_versions()
    267 # The decorator ensures this always returns the same handler (and it is only
    268 # attached once).
    269 @functools.cache
    270 def _ensure_handler():

File ~/.local/lib/python3.10/site-packages/matplotlib/__init__.py:260, in _check_versions()
    258 module = importlib.import_module(modname)
    259 if parse_version(module.__version__)  260     raise ImportError(f"Matplotlib requires {modname}>={minver}; "
    261                       f"you have {module.__version__}")

ImportError: Matplotlib requires numpy>=1.23; you have 1.21.5
**OS**: PopOS Thank you so much for any help! Feel free to migrate if there is a better Stackexchange for this question. I know there are a few others asking similar questions. Sadly, those appear to be focused on utilizing Python with homebrew.
Asked by user2231142 (111 rep)
Feb 16, 2025, 10:41 PM
Last activity: Feb 16, 2025, 10:43 PM