-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No module named matplotlib.colors #18
Comments
Firstly, thanks for looking at this code - I haven't played with it for a very long time (2 years according to my last fix). It sounds, to me, like you haven't got the python matplotlib library on your Pi. It can be installed like this:-
Of course, there may be more than one version of Python on your machine. The pip command above would normally default to Python2.x. You could try
Things can get complicated installing Python packages. I'm no expert but bear this in mind... You might need to add sudo to the start of the pip command to be able to update the system wide python packages. If you are running python in a virtual environment you should be inside the virtual env then run pip. Again, I'm no expert there I tend to use PyCharm and installing packages into a vritual environment is easy. However PyCharm on my Pi4 is mostly sloooow when typing stuff quickly. Hope that helps |
Thanks for the quick response. I tried the following commands to install (and then reinstall matplotlib). Most of the time, it said it was successful with an 'requirement already satisfied' response. What I didn't try was the virtual env. I have very little experience with a virtual environment, to the point where I'll need to do a little research on how to do that. I'll let you know once I've tried your suggestions with a virtual environment. I probably won't get to it until the weekend, so I'm in no rush. Plus it's all just me having fun experimenting with various libraries. On a side note, I noticed on ImageDemos.py there are two lines with the Python2 print command (as opposed to a print function |
The 'requirement satisfied' relates to dependencies that don't need to be installed because they are up to date. I'm sure you know that. Before attempting to install matplot lib did you apt update/upgrade the Pi? Did you try 'sudo pip install'? This might help: https://raspberrypi.stackexchange.com/questions/15420/how-to-install-python3-matplotlib-on-raspi/15457 You would know if you were working in a virtual environment because you would have to create one and switch into it. The advantage of those is that you don't clutter projects with un-necessary limports. You can zip/tar them up and copy them elsewhere. Did you check that matplot lib was installed? Start python and try to import it? Yes, originally written with python 2 on my machine but 'print' should be the only thing that was Python 2 specific (IIRC) so just add brackets. If I get time I might add a test for python version or import futures but I'm a bit busy with a micropython project at the moment |
I'm also having this same issue and can't seem to fix it. Did you manage to get it fixed @HundredVisionsGuy ? |
This is a problem caused by a failed matplotlib install or a dependency (like numpy) On my PC (Python 3.8) this works
and checking it with ...
On my Pi 3 with python3.5 I get the followng with matplotlib 3.0.3 and numpy 18.5
You probably just need to make sure you only have one version of numpy and matplotlib (pref latest). For python3.5 you can look in these folders:-
You can remove a package by simply removing the folders. |
ImageDemos.py keeps crashing with the no module named matplotlib.colors.
I imported matplotlib, and it was successful, but I still get the following error when trying to run ImageDemos.py:
Any thoughts?
PS - I forked your project, which is why the path looks different. I'm also running this on a Pi 4.
The text was updated successfully, but these errors were encountered: