Old python program no longer works after updating Pi3 to Pi4

42 Views Asked by At

OK, I'm reworking this question. I'm using Spyder 5.4.2 and Python 3.11.

I took the sample program from:

https://learn.sparkfun.com/tutorials/graph-sensor-data-with-python-and-matplotlib/update-a-graph-in-real-time

I get the following error:

In [10]: runfile('/home/pi/BrewPi/SparkfunExample.py', wdir='/home/pi/BrewPi') Traceback (most recent call last):

File /usr/lib/python3/dist-packages/spyder_kernels/py3compat.py:356 in compat_exec exec(code, globals, locals)

File ~/BrewPi/SparkfunExample.py:6 import matplotlib.pyplot as plt

File /usr/local/lib/python3.11/dist-packages/matplotlib/init.py:107 from collections import MutableMapping

ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.11/collections/init.py) reasons.

I'm beginning to suspect that my IDE environment is messed up. When I upgraded my hardware, from Pi3 to Pi4, and tried to install libraries to compile my original program, I installed them using the "--break-system-packages" option, because of other issues/reasons. Earlier Spyder/Python development on the Pi3 did not use virtual environments. (Interesting, a long time ago, I did encounter issues with Spyder and virtual environments on my desktop Kubuntu and gave up trying to develop Python code for the Pi.)

Any suggestions other than re-imaging my Pi4 and starting all over again?

0

There are 0 best solutions below