00:00
00:00
Newgrounds Background Image Theme

Our goal is for Newgrounds to be ad free for everyone! Become a Supporter today and help make this dream a reality!

Python: Matplotlib and Pandas Woes

696 Views | 3 Replies
New Topic Respond to this Topic

So, I'm not a games or flash programmer, I use Python mostly to process data (a la Data Science Wannabe) and matplotlib has been MISBEHAVING for me. I use Python 3.


This is apparently not an uncommon problem, I'm sure I can sift an answer out of the ether that is stackoverflow or one of the multitudes of other places, but I thought I'd throw it at NG and see what shakes out.


I have some issues. in Rasbian (debian/linux for Raspberry pi) matplotlib does not plot when I call the python script from a terminal shell, but it DOES plot when I run it from a dev environment (Thonny on Raspberry Pi). The script returns warnings because of future multidimensional array stuff being broken in pandas (using Pandas to read a datetime object is just a whole can of worms), but it works. I want it to work when I schedule it in crontab, which does not work. Do I have to pull a "python3 -m venv env" thing or something? It's just doing a histogram and a line chart, nothing super fancy, the idea is that the script runs every five minutes to update the graph, which is saved as a .png.


I can't run matplotlib on my Win10 machine at all right now. It's trainwrecked somehow. I've reinstalled it, uninstalled it, force-reinstalled it and manually copied the files into PATH directories and modified PATH and it's just... so... frustrating. Why does Win10 install Python in a weird tucked-away directory, it makes PATH WEIRD.

I usually use Spyder with Win10. matplotlib in Spyder doesn't work right now because I broke my matplotlib installation in the course of beating my head against it. I probably have to do a clean reinstall of Anaconda, etc. and I'm just too lazy to do it atm.

I want to be able to call a python script using matplotlib from Powershell. I recall this working for me previously, but I was running Python inside Powershell as a ... shell. Of power. With Python in it.

Response to Python: Matplotlib and Pandas Woes 2020-09-16 09:13:38


Clearly NG doesn't care about this but I have an update:


So I uninstalled python, but here's the thing: I had multiple versions of python from different sources. My best guess is that they all got "confused" whenever I tried to run a script. So, uninstalling every python distribution I could find on my drive (and manually removing every Python directory I couldn't uninstall directly) and then reinstalling a single Anaconda distribution seems to have fixed the problem I had with the Windows machine.


Still can't get the crontab thing to work on the raspberry pi, and actually now crontab lines that worked once no longer work (I mean, they literally worked ONE TIME), so I'm gonna have to look for other workarounds. Maybe call a script that calls a script.

Response to Python: Matplotlib and Pandas Woes 2020-09-19 20:10:29


I haven't eve really had any issues with matplotlib. I recently wrote a real-time stock ticker (using RH's api) and it took no time at all to get it looking nice.


If you still need any help, send me a PM and we can meet on discord and I can probably help you out.


= + ^ e * i pi 1 0

Response to Python: Matplotlib and Pandas Woes 2020-11-27 18:30:13


At 9/16/20 09:13 AM, EternalJudge wrote: Still can't get the crontab thing to work on the raspberry pi, and actually now crontab lines that worked once no longer work (I mean, they literally worked ONE TIME), so I'm gonna have to look for other workarounds. Maybe call a script that calls a script.


so crontab is trying to call your Python script correct? how is it calling it? Have you tried making your script explicitly executable with #!/pathtopython/python