3

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
  • you might try something similar to this answer: stackoverflow.com/a/71119218/588071 (swapping out numpy for matplotlib) Commented Jul 11, 2024 at 16:24
  • @tmdavison I had actually stumbled upon and tried to follow that answer, however it didn't seem to solve my issue. However, I started encountering a different error, to which the answer was useful in removing the broken matplotlib package. I have been able to reinstall matplotlib 3.5.1 onto my computer, and everything seems to be working fine now. Thank you for the help! Commented Jul 11, 2024 at 18:24

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.