skip to Main Content

I had originally updated matplotlib to 3.9.1 in WSL Ubuntu 22.04 LTS to replicate a bug that a colleague encountered in one of my programs, however when trying to revert to 3.5.1 (the one I was using before), I am encountering numerous issues, from being unable to install Matplotlib 3.5.1, unable to force reinstall Matplotlib 3.9.1, and being unable to remove Matplotlib entirely if it does somehow exists in my files.

I get the following issue when attempting to install Matplotlib 3.5.1 using pip3 install matplotlib==3.5.1:

Defaulting to user installation because normal site-packages is not writeable
Collecting matplotlib==3.5.1
  Using cached matplotlib-3.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB)
Requirement already satisfied: cycler>=0.10 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (4.53.1)
Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (1.4.5)
Requirement already satisfied: numpy>=1.17 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (2.0.0)
Requirement already satisfied: packaging>=20.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (24.1)
Requirement already satisfied: pillow>=6.2.0 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (10.4.0)
Requirement already satisfied: pyparsing>=2.2.1 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in ./.local/lib/python3.10/site-packages (from matplotlib==3.5.1) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in ./.local/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib==3.5.1) (1.16.0)
WARNING: No metadata found in ./.local/lib/python3.10/site-packages
Using cached matplotlib-3.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (11.9 MB)
WARNING: Error parsing dependencies of matplotlib: [Errno 2] No such file or directory: '/home/jjuvan25/.local/lib/python3.10/site-packages/matplotlib-3.9.1.dist-info/METADATA'
Installing collected packages: matplotlib
  Attempting uninstall: matplotlib
    WARNING: No metadata found in ./.local/lib/python3.10/site-packages
    Found existing installation: matplotlib 3.9.1
error: uninstall-no-record-file

× Cannot uninstall matplotlib 3.9.1
╰─> The package's contents are unknown: no RECORD file was found for matplotlib.

hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1

When I go to run the command line that the error suggests(pip install --force-reinstall --no-deps matplotlib==3.9.1), I receive the same error:

Defaulting to user installation because normal site-packages is not writeable
Collecting matplotlib==3.9.1
  Using cached matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
WARNING: No metadata found in ./.local/lib/python3.10/site-packages
Using cached matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.3 MB)
Installing collected packages: matplotlib
  Attempting uninstall: matplotlib
    WARNING: No metadata found in ./.local/lib/python3.10/site-packages
    Found existing installation: matplotlib 3.9.1
error: uninstall-no-record-file

× Cannot uninstall matplotlib 3.9.1
╰─> The package's contents are unknown: no RECORD file was found for matplotlib.

hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1

Attempting to uninstall Matplotlib with pip uninstall matplotlib returns the same error:

WARNING: No metadata found in ./.local/lib/python3.10/site-packages
Found existing installation: matplotlib 3.9.1
error: uninstall-no-record-file

× Cannot uninstall matplotlib 3.9.1
╰─> The package's contents are unknown: no RECORD file was found for matplotlib.

hint: You might be able to recover from this via: pip install --force-reinstall --no-deps matplotlib==3.9.1

Even attempting to remove and reinstall Matplotlib using sudo has failed. I fear that I may have broken my installation of Python and/or Ubuntu. I do have a backup of my files in the event I have to delete and reinstall either of the two, however this would be a last ditch effort if there is not a solution for the problem. Any and all help is appreciated!

2

Answers


  1. Interestingly, I encountered the same question today. I tried every attempt you did and coincidentally had the exact error messages as you (warning messages were different).

    After trial and error, I found replacing ‘–force-reinstall‘ with ‘–ignore-installed‘ can be effective. After that, I can continue to use matplotlib again.

    Later, I had some other technical problems regarding matplotlib. Following the instructions can solve the them.

    Login or Signup to reply.
  2. Find the Matplotlib folder in your site-packges folder:

    find ./.local/lib/python3.10/site-packages -name "matplotlib*"
    

    If found, remove it and try installing again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search