Python & pip installation problems

OS: Ubuntu-Mate 18.04
Platform: Raspberry Pi 3B
Python versions: 2.7 and 3.5, 3.6, and 3.7

I am attempting to run the latest Ubuntu-Mate 18.04 release on my RPi 3B that has installed successfully. However, there is a problem with the Python and pip versions that were installed or upgraded. I’ve searched for solutions and tried different suggestions but I’ve ended up with import problems due to the different Python and pip versions installed/upgraded. I tried to upgrade Python to 3.7 but that failed to pass the tests and eventually aborted. I’m currently running 3.5 because that’s what opencv built to support.

I also found that there is a bug reported, see link, that I don’t have an account to logon but thought it might be relevant to my problems. For now, Python 2 and 3 work as long as I’m not root or sudo. I would like to cleanup both Python and pip for the future. I need these to support opencv (cv2), kivy, and nodejs.

https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1772746

Outside of this problem, Ubuntu-Mate 16.04 and 18.04 works great on RPi 2 and 3B for my tests. Thank you in advance for any suggestions.

One way around this is to use a Python “virtual environment”. I realize it can be a bit scary to use this but it really is the right thing especially for projects that need a stable set of libraries that are unrelated to the “system Python”. This is because things can get out of sorts when you use pip to install libraries vs apt into the global Python installation. With a virtualenv you can only install things via pip so the problem goes away.

https://docs.python.org/3/tutorial/venv.html