Reputation: 13
I am using Windows 11 on an HP laptop, purchased August 2024. I have installed Python, then added matplotlib (using the command line from PowerShell) and it seemed to be working (In PowerShell I simply typed python -m pip install matplotlib
but note that now I have also tried python3.13 -m pip install matplotlib
which was suggested by another question, but the console just said that python3.13 (my version) was not a command). I could run a simple program from w3schools.com using matplotlib.
Then I installed Manim using the Chocolatey package manager (as recommended for the Manim community version). This was by typing: choco install manimce
. Now I can't use matplotlib anymore. I can download the package using pip, but the following code won't run:
import matplotlib.pyplot as plt
import numpy as np
y = np.array([35, 25, 25, 15])
mylabels = ["Apples", "Bananas", "Cherries", "Dates"]
plt.pie(y, labels = mylabels)
plt.show()
I have tried running this from the code editor and clicking "run" from the menu options. My editor is called "IDLE", which I have used for every piece of code I have run.
The output from the code: import sys; print(sys.path)
is as follows:
['C:/<MYSTUFF>/<MY OWN PROGRAMS>/Python code', 'C:\\Python312\\Lib\\idlelib', 'C:\\Python312\\python312.zip', 'C:\\Python312\\DLLs', 'C:\\Python312\\Lib', 'C:\\Python312', 'C:\\Users\\<MY USERNAME>\\AppData\\Roaming\\Python\\Python312\\site-packages', 'C:\\Python312\\Lib\\site-packages', 'C:\\tools\\Manim\\Lib\\site-packages']
So whilst I use the command line for installing packages, I am not running any of these programs from the command line, just the code editor. Then the shell for my IDLE editor reports this:
Traceback (most recent call last): File "C:\MYFOLDERSETC\python tester 2.py", line 1, in <module> import matplotlib as plt ModuleNotFoundError: No module named 'matplotlib'
The output for the command python -m pip freeze
is as follows:
click==8.1.7
cloup==3.0.5
colorama==0.4.6
contourpy==1.3.1
cycler==0.12.1
decorator==5.1.1
fonttools==4.55.2
glcontext==3.0.0
isosurfaces==0.1.2
kiwisolver==1.4.7
manim==0.18.1
ManimPango==0.6.0
mapbox_earcut==1.0.2
markdown-it-py==3.0.0
matplotlib==3.9.3
mdurl==0.1.2
moderngl==5.12.0
moderngl-window==3.0.3
networkx==3.4.2
numpy==2.1.3
packaging==24.2
pillow==11.0.0
pycairo==1.27.0
pydub==0.25.1
pyglet==2.0.20
PyGLM==2.7.3
Pygments==2.18.0
pyparsing==3.2.0
python-dateutil==2.9.0.post0
rich==13.9.4
scipy==1.14.1
screeninfo==0.8.1
setuptools==75.6.0
six==1.17.0
skia-pathops==0.8.0.post2
srt==3.5.3
svgelements==1.9.6
tqdm==4.67.1
typing_extensions==4.12.2
watchdog==6.0.0
wheel==0.45.
I have tried reinstalling matplotlib from the command line, but the same thing happens each time. I can use numpy to generate simple random numbers, so something is still working. I have tried all the solutions from similar questions on SO, but nothing changes.
I used Chocolatey to install Manim, and tried using it to install matplotlib, but it wouldn't install. I previously have installed all packages (including matplotlib) from the command line) using pip.
What is going wrong, and how can I fix this?
Upvotes: 1
Views: 83